[Goodies-commits] r6151 - in xfce4-places-plugin/trunk: . panel-plugin
Diego Ongaro
ongardie at xfce.org
Fri Nov 21 20:19:51 CET 2008
Author: ongardie
Date: 2008-11-21 19:19:51 +0000 (Fri, 21 Nov 2008)
New Revision: 6151
Modified:
xfce4-places-plugin/trunk/ChangeLog
xfce4-places-plugin/trunk/panel-plugin/button.c
xfce4-places-plugin/trunk/panel-plugin/button.h
Log:
button.{c,h}: Fix warnings and segfault on plugin exit
The warnings were caused by theme-changed after dispose. This would in
turn call places_button_resize, which expected the reference to the
plugin to be non-NULL.
To fix this, button.c now disconnects its signal handlers on dispose and
also handles a non-NULL plugin reference in places_button_resize.
These fixes had the side effect of not corrupting the view's memory.
Modified: xfce4-places-plugin/trunk/ChangeLog
===================================================================
--- xfce4-places-plugin/trunk/ChangeLog 2008-11-21 17:57:54 UTC (rev 6150)
+++ xfce4-places-plugin/trunk/ChangeLog 2008-11-21 19:19:51 UTC (rev 6151)
@@ -1,5 +1,6 @@
2008-11-21 Diego Ongaro <ongardie at gmail.com>
+ * button.{c,h}: Fix warnings and segfault on plugin exit
* INSTALL: updated with newer version of autotools
2008-06-07 Diego Ongaro <ongardie at gmail.com>
Modified: xfce4-places-plugin/trunk/panel-plugin/button.c
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/button.c 2008-11-21 17:57:54 UTC (rev 6150)
+++ xfce4-places-plugin/trunk/panel-plugin/button.c 2008-11-21 19:19:51 UTC (rev 6151)
@@ -262,9 +262,9 @@
g_signal_connect(G_OBJECT(plugin), "size-changed",
G_CALLBACK(places_button_size_changed), self);
- g_signal_connect(G_OBJECT(self), "style-set",
+ self->style_set_id = g_signal_connect(G_OBJECT(self), "style-set",
G_CALLBACK(places_button_theme_changed), NULL);
- g_signal_connect(G_OBJECT(self), "screen-changed",
+ self->screen_changed_id = g_signal_connect(G_OBJECT(self), "screen-changed",
G_CALLBACK(places_button_theme_changed), NULL);
}
@@ -288,6 +288,16 @@
{
PlacesButton *self = PLACES_BUTTON(object);
+ if (self->style_set_id != 0) {
+ g_signal_handler_disconnect(self, self->style_set_id);
+ self->style_set_id = 0;
+ }
+
+ if (self->screen_changed_id != 0) {
+ g_signal_handler_disconnect(self, self->screen_changed_id);
+ self->screen_changed_id = 0;
+ }
+
if (self->plugin != NULL) {
g_object_unref(self->plugin);
self->plugin = NULL;
@@ -393,6 +403,9 @@
gint button_width, button_height;
gint box_width, box_height;
+ if (self->plugin == NULL)
+ return;
+
new_size = xfce_panel_plugin_get_size(self->plugin);
self->plugin_size = new_size;
DBG("Panel size: %d", new_size);
@@ -440,7 +453,6 @@
total_height += label_height;
}
}
-
/* at this point, total width and height reflect just image and label */
/* now, add on the button and box overhead */
total_width += button_width;
Modified: xfce4-places-plugin/trunk/panel-plugin/button.h
===================================================================
--- xfce4-places-plugin/trunk/panel-plugin/button.h 2008-11-21 17:57:54 UTC (rev 6150)
+++ xfce4-places-plugin/trunk/panel-plugin/button.h 2008-11-21 19:19:51 UTC (rev 6151)
@@ -51,6 +51,8 @@
gchar *label_text;
places_button_image_pixbuf_factory *pixbuf_factory;
gint plugin_size;
+ gulong style_set_id;
+ gulong screen_changed_id;
};
struct _PlacesButtonClass
More information about the Goodies-commits
mailing list