]> git.draconx.ca Git - liblbx.git/commitdiff
lbxgui: Make an effort to not leak resources.
authorNick Bowler <nbowler@draconx.ca>
Tue, 9 Feb 2010 04:13:50 +0000 (23:13 -0500)
committerNick Bowler <nbowler@draconx.ca>
Tue, 9 Feb 2010 04:13:50 +0000 (23:13 -0500)
src/gui/lbxgui.c

index ebb92abd52545428c17f76d8c3e15192bc5be67c..21256e4f0a6ccab2931a94116bb575160aea4433 100644 (file)
@@ -203,6 +203,11 @@ static int init_framedata(int reset)
 
 static int img_close(void *handle)
 {
+       if (framebuf) {
+               g_object_unref(framebuf);
+               framebuf = NULL;
+       }
+
        lbx_file_close(handle);
        return 0;
 }
@@ -281,6 +286,11 @@ void set_image_data(GtkComboBox *combo)
 
        f = lbx_file_open(lbx, index);
        if (f) {
+               if (image) {
+                       lbximg_close(image);
+                       image = NULL;
+               }
+
                image = lbximg_open(f, &lbx_arch_fops, img_close);
                if (image) {
                        memset(palette_internal, 0, sizeof palette_internal);