Merge lp:~jjardon/indicator-datetime/fix-794312 into lp:indicator-datetime/0.3

Proposed by Javier Jardón
Status: Work in progress
Proposed branch: lp:~jjardon/indicator-datetime/fix-794312
Merge into: lp:indicator-datetime/0.3
Diff against target: 29 lines (+4/-3)
1 file modified
src/indicator-datetime.c (+4/-3)
To merge this branch: bzr merge lp:~jjardon/indicator-datetime/fix-794312
Reviewer Review Type Date Requested Status
Charles Kerr (community) Needs Fixing
Review via email: mp+79426@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Charles Kerr (charlesk) wrote :

I appreciate this patch, especially since the ticket was (incorrectly) closed as a duplicate of an unrelated ticket :) But, I don't think it addresses the OP's crash -- the retrace shows the final two steps were:

> g_type_check_instance_cast (type_instance=0x2849cb0, iface_type=42195904)
> ido_calendar_menu_item_set_date (menuitem=0x27d7440, year=2011, month=5, day=7) at idocalendarmenuitem.c:383

menuitem wasn't NULL in this trace, so guarding against NULL in the calling code probably won't help. In fact, ido_calendar_menu_item_set_date() is already safeguarding against NULL pointers in its first line that calls IDO_IS_CALENDAR_MENU_ITEM(). That's already null-safe -- but, unfortunately, not corrupt-pointer safe, which is why g_type_check_instance_cast() is crashing. ;)

review: Needs Fixing

Unmerged revisions

142. By Javier Jardón

indicator-datetime.c: Do not connect the signal before the menu is created

Fixes https://bugs.launchpad.net/ubuntu/+source/indicator-datetime/+bug/794312

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/indicator-datetime.c'
2--- src/indicator-datetime.c 2011-09-21 20:19:53 +0000
3+++ src/indicator-datetime.c 2011-10-14 17:23:25 +0000
4@@ -277,7 +277,8 @@
5 g_date_time_unref (datetime);
6
7 // Set the calendar to todays date
8- ido_calendar_menu_item_set_date (self->priv->ido_calendar, y, m-1, d);
9+ if (self->priv->ido_calendar)
10+ ido_calendar_menu_item_set_date (self->priv->ido_calendar, y, m-1, d);
11
12 // Make sure the day-selected signal is sent so the menu updates - may duplicate
13 /*GVariant *variant = g_variant_new_uint32((guint)curtime);
14@@ -367,13 +368,13 @@
15
16 self->priv->menu = dbusmenu_gtkmenu_new(SERVICE_NAME, MENU_OBJ);
17
18- g_signal_connect(self->priv->menu, "notify::visible", G_CALLBACK(menu_visible_notfy_cb), self);
19-
20 DbusmenuGtkClient *client = dbusmenu_gtkmenu_get_client(self->priv->menu);
21 dbusmenu_client_add_type_handler_full(DBUSMENU_CLIENT(client), DBUSMENU_CALENDAR_MENUITEM_TYPE, new_calendar_item, self, NULL);
22 dbusmenu_client_add_type_handler_full(DBUSMENU_CLIENT(client), APPOINTMENT_MENUITEM_TYPE, new_appointment_item, self, NULL);
23 dbusmenu_client_add_type_handler_full(DBUSMENU_CLIENT(client), TIMEZONE_MENUITEM_TYPE, new_timezone_item, self, NULL);
24
25+ g_signal_connect(self->priv->menu, "notify::visible", G_CALLBACK(menu_visible_notfy_cb), self);
26+
27 self->priv->service_proxy_cancel = g_cancellable_new();
28
29 g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,

Subscribers

People subscribed via source and target branches