diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-03-19 19:55:58 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-03-19 19:55:58 +0100 |
commit | d1a8285f818eb7e5c3d6a05709ea21a808490b8c (patch) | |
tree | 326578f0505cbed07cfe60de530022822dc237ac /app/wlib/gtklib/font.c | |
parent | 16e9630b79f0a7a90c6cedb6781175bb8b337dc1 (diff) |
New upstream version 5.1.0upstream/5.1.0
Diffstat (limited to 'app/wlib/gtklib/font.c')
-rw-r--r-- | app/wlib/gtklib/font.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/wlib/gtklib/font.c b/app/wlib/gtklib/font.c index c54f7de..68ba87b 100644 --- a/app/wlib/gtklib/font.c +++ b/app/wlib/gtklib/font.c @@ -86,7 +86,7 @@ static void fontSelectionDialogCallback(GtkFontSelectionDialog *fontSelectionDialog, gint response, gpointer data) { if (response == GTK_RESPONSE_APPLY || response == GTK_RESPONSE_OK) { - gchar *fontName; + gchar *fontName; fontName = gtk_font_selection_dialog_get_font_name(fontSelectionDialog); wPrefSetString("font", "name", fontName); @@ -215,12 +215,14 @@ PangoLayout *wlibFontCreatePangoLayout(GtkWidget *widget, pango_layout_set_font_description(layout, fontDescription); /* get layout measures */ pango_layout_get_pixel_size(layout, width_p, height_p); - context = gtk_widget_get_pango_context(widget); + context = gtk_widget_create_pango_context(widget); metrics = pango_context_get_metrics(context, fontDescription, pango_context_get_language(context)); *ascent_p = PANGO_PIXELS(pango_font_metrics_get_ascent(metrics)); *descent_p = PANGO_PIXELS(pango_font_metrics_get_descent(metrics)); pango_font_metrics_unref(metrics); + g_object_ref_sink(context); + g_object_unref(context); #if WLIB_FONT_DEBUG >= 3 fprintf(stderr, "font layout created:\n"); fprintf(stderr, " widget: %p\n", widget); @@ -242,7 +244,8 @@ PangoLayout *wlibFontCreatePangoLayout(GtkWidget *widget, void wlibFontDestroyPangoLayout(PangoLayout *layout) { - g_object_unref(G_OBJECT(layout)); + g_object_ref_sink(layout); + g_object_unref(layout); } /** @@ -286,7 +289,7 @@ void wSelectFont( gtk_window_set_title(GTK_WINDOW(fontSelectionDialog), title); if (curFont != NULL) { - gchar *fontName; + gchar *fontName; /* the curFont description contains the latest font info * which is depended on the current scale |