summaryrefslogtreecommitdiff
path: root/gtk/window-decorator/switcher.c
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-02-21 20:55:51 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-02-21 20:55:51 +0800
commitd10bd89e7ca542bd227281e81626adcaf65f9adb (patch)
tree1ea9743443b9b33ce6c20e4976d158ff794fa403 /gtk/window-decorator/switcher.c
parent04c7585cd31d4b1ccd9be175ff9f296bad41598e (diff)
downloadcompiz-with-glib-mainloop-d10bd89e7ca542bd227281e81626adcaf65f9adb.tar.gz
compiz-with-glib-mainloop-d10bd89e7ca542bd227281e81626adcaf65f9adb.tar.bz2
Fix memory leaks
- Use gtk_main_quit (); - Don't create gconf clients where we don't need to
Diffstat (limited to 'gtk/window-decorator/switcher.c')
-rw-r--r--gtk/window-decorator/switcher.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/gtk/window-decorator/switcher.c b/gtk/window-decorator/switcher.c
index 177e4c3..1aec3b1 100644
--- a/gtk/window-decorator/switcher.c
+++ b/gtk/window-decorator/switcher.c
@@ -63,6 +63,7 @@ create_switcher_frame (const gchar *type)
void
destroy_switcher_frame (decor_frame_t *frame)
{
+ gtk_widget_destroy (switcher_label);
decor_frame_destroy (frame);
}
@@ -244,10 +245,6 @@ draw_switcher_background (decor_t *d)
cairo_destroy (cr);
- GdkPixbuf *buf = gdk_pixbuf_get_from_drawable (NULL, d->buffer_pixmap, NULL, 0, 0, 0, 0, d->width, d->height);
-
- gdk_pixbuf_save (buf, "/home/smspillaz/rendered_switcher.png", "png", NULL, NULL);
-
copy_to_front_buffer (d);
pixel = ((((a * style->bg[GTK_STATE_NORMAL].blue ) >> 24) & 0x0000ff) |
@@ -330,6 +327,27 @@ draw_switcher_decoration (decor_t *d)
void
switcher_window_closed ()
{
+ decor_t *d = switcher_window;
+ Display *xdisplay = gdk_x11_get_default_xdisplay ();
+
+ if (d->layout)
+ g_object_unref (G_OBJECT (d->layout));
+
+ if (d->name)
+ g_free (d->name);
+
+ if (d->pixmap)
+ g_object_unref (G_OBJECT (d->pixmap));
+
+ if (d->buffer_pixmap)
+ g_object_unref (G_OBJECT (d->buffer_pixmap));
+
+ if (d->cr)
+ cairo_destroy (d->cr);
+
+ if (d->picture)
+ XRenderFreePicture (xdisplay, d->picture);
+
gwd_decor_frame_unref (switcher_window->frame);
g_free (switcher_window);
switcher_window = NULL;