gnucash maint: GValue: don't unset until the boxed pointer isn't used anymore

Christopher Lam clam at code.gnucash.org
Thu Jun 17 11:52:01 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/e7076b41 (commit)
	from  https://github.com/Gnucash/gnucash/commit/36d119d8 (commit)



commit e7076b41ac91b505ee69c573919f9464cabea56e
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Jun 17 21:05:17 2021 +0800

    GValue: don't unset until the boxed pointer isn't used anymore
    
    Because GValue was unset earlier in this function, the
    default_font_family would point to garbage. We need to unset the
    GValue after the default_font_family is used to set the GObject.

diff --git a/gnucash/html/gnc-html-webkit2.c b/gnucash/html/gnc-html-webkit2.c
index f776b33ce..a892a4cb9 100644
--- a/gnucash/html/gnc-html-webkit2.c
+++ b/gnucash/html/gnc-html-webkit2.c
@@ -142,7 +142,6 @@ gnc_html_webkit_webview_new (void)
       const PangoFontDescription *font =
            (const PangoFontDescription*)g_value_get_boxed (&val);
       default_font_family = pango_font_description_get_family (font);
-      g_value_unset (&val);
      }
 /* Set default webkit settings */
      webkit_settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (view));
@@ -162,6 +161,7 @@ gnc_html_webkit_webview_new (void)
           g_object_set (G_OBJECT (webkit_settings),
               "default-font-family", default_font_family, NULL);
      }
+     g_value_unset (&val);
      return view;
 }
 



Summary of changes:
 gnucash/html/gnc-html-webkit2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



More information about the gnucash-changes mailing list