summaryrefslogtreecommitdiff
path: root/pango/pangowin32.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2013-02-25 23:37:16 -0500
committerBehdad Esfahbod <behdad@behdad.org>2013-02-25 23:37:16 -0500
commit0654dfb2ddc66fe70cd5582ccc0ec08ba8154ac6 (patch)
tree57ddf6d270637558bac345f45585457d371f1b3a /pango/pangowin32.c
parentb740729a6dfe58b0d8673a48ae96626ff851c122 (diff)
downloadpango-0654dfb2ddc66fe70cd5582ccc0ec08ba8154ac6.tar.gz
[win32] Fix assertion and warnings
When win32 fontmap goes away, font->fontmap becomes NULL. Deal with that. Technically speaking, we need to port this to GWeakRef like the other fontmaps do. But this would do for now.
Diffstat (limited to 'pango/pangowin32.c')
-rw-r--r--pango/pangowin32.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index a1594266..8678ebbc 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -93,6 +93,8 @@ _pango_win32_font_get_hfont (PangoFont *font)
if (!win32font->hfont)
{
cache = pango_win32_font_map_get_font_cache (win32font->fontmap);
+ if (G_UNLIKELY (!cache))
+ return NULL;
win32font->hfont = pango_win32_font_cache_loadw (cache, &win32font->logfontw);
if (!win32font->hfont)
@@ -816,6 +818,8 @@ pango_win32_font_finalize (GObject *object)
{
PangoWin32Font *win32font = (PangoWin32Font *)object;
PangoWin32FontCache *cache = pango_win32_font_map_get_font_cache (win32font->fontmap);
+ if (G_UNLIKELY (!cache))
+ return NULL;
if (win32font->hfont != NULL)
pango_win32_font_cache_unload (cache, win32font->hfont);
@@ -828,9 +832,11 @@ pango_win32_font_finalize (GObject *object)
g_hash_table_destroy (win32font->glyph_info);
- g_assert (win32font->fontmap != NULL);
- g_object_remove_weak_pointer (G_OBJECT (win32font->fontmap), (gpointer *) (gpointer) &win32font->fontmap);
- win32font->fontmap = NULL;
+ if (win32font->fontmap)
+ {
+ g_object_remove_weak_pointer (G_OBJECT (win32font->fontmap), (gpointer *) (gpointer) &win32font->fontmap);
+ win32font->fontmap = NULL;
+ }
G_OBJECT_CLASS (_pango_win32_font_parent_class)->finalize (object);
}