diff options
author | rbuj <[email protected]> | 2022-01-28 11:26:20 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-05-11 15:19:08 +0200 |
commit | ff9924aacd16a70816ec8acdff9b0a87a5cfd343 (patch) | |
tree | b64663f6d2936935a1329e3c921a4b67607bc7c1 | |
parent | 44624265085b50a38ef2241d36a677459752b15f (diff) | |
download | libmatekbd-ff9924aacd16a70816ec8acdff9b0a87a5cfd343.tar.bz2 libmatekbd-ff9924aacd16a70816ec8acdff9b0a87a5cfd343.tar.xz |
matekbd-keyboard-drawing: fix memory leak
-rw-r--r-- | libmatekbd/matekbd-keyboard-drawing.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libmatekbd/matekbd-keyboard-drawing.c b/libmatekbd/matekbd-keyboard-drawing.c index 086b2e3..e2e4842 100644 --- a/libmatekbd/matekbd-keyboard-drawing.c +++ b/libmatekbd/matekbd-keyboard-drawing.c @@ -1630,16 +1630,15 @@ alloc_render_context (MatekbdKeyboardDrawing * drawing) GtkStyleContext *style_context = gtk_widget_get_style_context (GTK_WIDGET (drawing)); - PangoFontDescription *fd = NULL; gtk_style_context_get (style_context, gtk_style_context_get_state (style_context), - GTK_STYLE_PROPERTY_FONT, &fd, NULL); + GTK_STYLE_PROPERTY_FONT, &context->font_desc, + NULL); context->layout = pango_layout_new (pangoContext); pango_layout_set_ellipsize (context->layout, PANGO_ELLIPSIZE_END); - context->font_desc = pango_font_description_copy (fd); context->angle = 0; context->scale_numerator = 1; context->scale_denominator = 1; @@ -2446,7 +2445,7 @@ matekbd_keyboard_drawing_render (MatekbdKeyboardDrawing * kbdrawing, GtkStyleContext *style_context = gtk_widget_get_style_context (GTK_WIDGET (kbdrawing)); GdkRGBA dark_color; - PangoFontDescription *fd = NULL; + PangoFontDescription *fd; gtk_style_context_get_background_color (style_context, gtk_style_context_get_state (style_context), @@ -2458,21 +2457,25 @@ matekbd_keyboard_drawing_render (MatekbdKeyboardDrawing * kbdrawing, gtk_style_context_get (style_context, gtk_style_context_get_state (style_context), - GTK_STYLE_PROPERTY_FONT, &fd, NULL); - fd = pango_font_description_copy (fd); + GTK_STYLE_PROPERTY_FONT, &fd, + NULL); MatekbdKeyboardDrawingRenderContext context = { cr, kbdrawing->renderContext->angle, layout, - pango_font_description_copy (fd), + fd, 1, 1, dark_color }; if (!context_setup_scaling (&context, kbdrawing, width, height, dpi_x, dpi_y)) + { + pango_font_description_free (fd); return FALSE; + } + cairo_translate (cr, x, y); draw_keyboard_to_context (&context, kbdrawing); |