Merge lp:~mterry/indicator-applet/global-desc-update-callback into lp:indicator-applet/0.4

Proposed by Michael Terry
Status: Merged
Merged at revision: 386
Proposed branch: lp:~mterry/indicator-applet/global-desc-update-callback
Merge into: lp:indicator-applet/0.4
Diff against target: 47 lines (+17/-6)
1 file modified
src/applet-main.c (+17/-6)
To merge this branch: bzr merge lp:~mterry/indicator-applet/global-desc-update-callback
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+57533@code.launchpad.net

Description of the change

Every time an indicator-applet adds an entry, it connects to the global IndicatorObject INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE signal with the new entry menuitem as an argument.

But it never cleaned it up, meaning that we could crash after the menuitem goes away and another entry emits the DESC_UPDATE signal.

This branch changes it to just one signal connection and has the applet search for the right entry. This matches how it handles other global signals.

This might fix linked bug 745115.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/applet-main.c'
--- src/applet-main.c 2011-03-22 20:35:19 +0000
+++ src/applet-main.c 2011-04-13 16:29:30 +0000
@@ -266,10 +266,22 @@
266}266}
267267
268static void268static void
269accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menuitem)269accessible_desc_update_cb (GtkWidget * widget, gpointer userdata)
270{270{
271 g_return_if_fail(GTK_IS_WIDGET(menuitem));271 gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY);
272 update_accessible_desc(entry, menuitem);272
273 if (data != userdata) {
274 return;
275 }
276
277 IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data;
278 update_accessible_desc(entry, widget);
279}
280
281static void
282accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
283{
284 gtk_container_foreach(GTK_CONTAINER(menubar), accessible_desc_update_cb, entry);
273 return;285 return;
274}286}
275287
@@ -350,8 +362,6 @@
350362
351 gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos);363 gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos);
352364
353 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menuitem);
354
355 if (something_visible) {365 if (something_visible) {
356 if (entry->accessible_desc != NULL) {366 if (entry->accessible_desc != NULL) {
357 update_accessible_desc(entry, menuitem);367 update_accessible_desc(entry, menuitem);
@@ -529,6 +539,7 @@
529 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed), menubar);539 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed), menubar);
530 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, G_CALLBACK(entry_moved), menubar);540 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, G_CALLBACK(entry_moved), menubar);
531 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW, G_CALLBACK(menu_show), menubar);541 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW, G_CALLBACK(menu_show), menubar);
542 g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menubar);
532543
533 /* Work on the entries */544 /* Work on the entries */
534 GList * entries = indicator_object_get_entries(io);545 GList * entries = indicator_object_get_entries(io);

Subscribers

People subscribed via source and target branches

to status/vote changes: