Skip to content

[th/fontmap-weak-ref] fix wrong usages of GWeakRef by using g_object_add_weak_pointer()

Thomas Haller requested to merge th/fontmap-weak-ref into main

The way how GWeakRef are used for fontmap is wrong. Especially since glib!3834 (merged), the internal representation of a weak pointer changed.

Actually, in pangofc-font and pangocoretext, the wrong usage mostly works, because the field is exclusively set via g_weak_ref_set(). But for pangowin32-fontmap, _pango_cairo_win32_font_new() sets the pointer directly. This leads to a crash and assertion failure.

Fixes: #786

Replace GWeakRef with g_object_add_weak_pointer(). That is not thread safe, but that doesn't seem to be a concern here.

Also, various places don't seem to properly take into account, that the pointer might be NULL. That is not changed either.

(I could not test the changes!!)

Merge request reports