A couple more thoughts about the AppMenuItem. Regarding reference
counting:
AppMenuItem *
app_menu_item_new (IndicateListener * listener, IndicateListenerServer * server)
{
AppMenuItem * self = g_object_new(APP_MENU_ITEM_TYPE, NULL);
AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self);
priv->listener = listener;
priv->server = server;
...
}
We're holding onto a pointer to listener, but we never actually
g_object_ref() it. If that Listener were to unref to 0 before this
AppMenuItem does, then once AppMenuItem hits 0 its finalize is going to
try to disconnect signal handlers using a probably invalid pointer. And
I'm also not sure if we're disconnecting signals in the correct place
either anyway..
static void
app_menu_item_dispose (GObject *object)
{
G_OBJECT_CLASS (app_menu_item_parent_class)->dispose (object);
}
static void
app_menu_item_finalize (GObject *object)
{
AppMenuItem * self = APP_MENU_ITEM(object);
AppMenuItemPrivate * priv = APP_MENU_ITEM_GET_PRIVATE(self);
g_signal_handlers_disconnect_by_func(G_OBJECT(priv->listener),
G_CALLBACK(indicator_added_cb), self);
g_signal_handlers_disconnect_by_func(G_OBJECT(priv->listener),
G_CALLBACK(indicator_removed_cb), self);
G_OBJECT_CLASS (app_menu_item_parent_class)->finalize (object);
return;
}
Right now we have a dispose method that's not doing anything. If we
were holding any references to other objects, that would be the right
place to unref them I think. And while we're unreffing them we would
also need to disconnect any signal handlers related to them.
--
indicator-applet crashed with SIGSEGV in strcmp()
https://bugs.launchpad.net/bugs/362124
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs