Fix:core:When destroying the graphics, destroy the graphics_gc's too, guard graphics_...
authorwoglinde <woglinde@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 20 Jan 2012 21:32:30 +0000 (21:32 +0000)
committerwoglinde <woglinde@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Fri, 20 Jan 2012 21:32:30 +0000 (21:32 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4900 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/graphics.c

index 165d02d..2040e72 100644 (file)
@@ -402,6 +402,9 @@ void graphics_free(struct graphics *gra)
 {
        if (!gra)
                return;
+        graphics_gc_destroy(gra->gc[0]);
+        graphics_gc_destroy(gra->gc[1]);
+        graphics_gc_destroy(gra->gc[2]);
        gra->meth.graphics_destroy(gra->priv);
        g_free(gra->default_font);
        graphics_font_destroy_all(gra);
@@ -449,6 +452,8 @@ struct graphics_gc * graphics_gc_new(struct graphics *gra)
 */
 void graphics_gc_destroy(struct graphics_gc *gc)
 {
+       if (!gc)
+            return;
        gc->meth.gc_destroy(gc->priv);
        g_free(gc);
 }