After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 672381 - invalid uninstantiatable type `<invalid>' in cast to `FolksIndividual'
invalid uninstantiatable type `<invalid>' in cast to `FolksIndividual'
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: general
git master
Other Linux
: Normal major
: Unset
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2012-03-19 09:36 UTC by Guillaume Desmottes
Modified: 2012-03-19 13:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Persona: make sure to NULL-ify the individual when it's destroyed (1.27 KB, patch)
2012-03-19 13:22 UTC, Guillaume Desmottes
needs-work Details | Review
Persona: make sure to NULL-ify the individual when it's destroyed (1.81 KB, patch)
2012-03-19 13:29 UTC, Guillaume Desmottes
accepted-commit_now Details | Review
Persona: make sure to NULL-ify the individual when it's destroyed (1.70 KB, patch)
2012-03-19 13:41 UTC, Guillaume Desmottes
committed Details | Review

Description Guillaume Desmottes 2012-03-19 09:36:07 UTC
I was trying to reproduce bug #670523 with folks master + the patch from https://bugzilla.gnome.org/show_bug.cgi?id=670523#c7:
- Start empathy and empathy-chat
- Send a message to a contact
- Disconnect and reconnect the CM used to send the message
- empathy-chat crashed

GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `FolksIndividual'



  • #0 folks_individual_get_personas
    at /home/cassidy/gnome/folks/folks/individual.vala line 798
  • #1 folks_persona_get_individual
    at /home/cassidy/gnome/folks/folks/persona.vala line 154
  • #2 _folks_individual_disconnect_from_persona
    at /home/cassidy/gnome/folks/folks/individual.vala line 1625
  • #3 _folks_individual_set_personas
    at /home/cassidy/gnome/folks/folks/individual.vala line 1969
  • #4 folks_individual_set_personas
    at /home/cassidy/gnome/folks/folks/individual.vala line 799
  • #5 _folks_individual_aggregator_personas_changed_cb
    at /home/cassidy/gnome/folks/folks/individual-aggregator.vala line 1345
  • #6 __folks_individual_aggregator_personas_changed_cb_folks_persona_store_personas_changed
    at /home/cassidy/gnome/folks/folks/individual-aggregator.vala line 758
  • #7 g_cclosure_user_marshal_VOID__OBJECT_OBJECT_STRING_OBJECT_ENUM
  • #8 g_closure_invoke
    at gclosure.c line 777
  • #9 signal_emit_unlocked_R
    at gsignal.c line 3547
  • #10 g_signal_emit_valist
    at gsignal.c line 3295
  • #11 g_signal_emit_by_name
    at gsignal.c line 3389
  • #12 _folks_persona_store_emit_personas_changed
    at /home/cassidy/gnome/folks/folks/persona-store.vala line 395
  • #13 _tpf_persona_store_notify_connection_cb
    at /home/cassidy/gnome/folks/backends/telepathy/lib/tpf-persona-store.vala line 862
  • #14 __tpf_persona_store_notify_connection_cb_g_object_notify
    at /home/cassidy/gnome/folks/backends/telepathy/lib/tpf-persona-store.vala line 641
  • #15 g_cclosure_marshal_VOID__PARAM
    at gmarshal.c line 1042
  • #16 g_closure_invoke
    at gclosure.c line 777
  • #17 signal_emit_unlocked_R
    at gsignal.c line 3547
  • #18 g_signal_emit_valist
    at gsignal.c line 3295
  • #19 g_signal_emit
    at gsignal.c line 3352
  • #20 g_object_dispatch_properties_changed
    at gobject.c line 1041
  • #21 g_object_notify_by_spec_internal
    at gobject.c line 1133
  • #22 g_object_notify
    at gobject.c line 1175
  • #23 _tp_account_set_connection
    at account.c line 538
  • #24 _tp_account_update
    at account.c line 924
  • #25 _tp_cli_account_invoke_callback_for_account_property_changed
    at ../telepathy-glib/_gen/tp-cli-account-body.h line 94
  • #26 tp_proxy_signal_invocation_run
    at proxy-signals.c line 268
  • #27 g_idle_dispatch
    at gmain.c line 4629
  • #28 g_main_dispatch
    at gmain.c line 2510
  • #29 g_main_context_dispatch
    at gmain.c line 3047
  • #30 g_main_context_iterate
    at gmain.c line 3118
  • #31 g_main_context_iteration
    at gmain.c line 3179
  • #32 g_application_run
    at gapplication.c line 1496
  • #33 main
    at empathy-chat.c line 166
            arg_data = 0x0, description = 0x0, arg_description = 0x0}}
        debug_sender = 0x829720
        error = 0x0
        presence_mgr = 0x82c0b0
        theme_mgr = 0x745640
        retval = 0
        individual_mgr = 0x7119c0
        __PRETTY_FUNCTION__ = "main"
Comment 1 Guillaume Desmottes 2012-03-19 09:42:25 UTC
I reproduced it in valgrind:


==15182== Invalid read of size 8
==15182==    at 0x703C0D8: g_type_check_instance_cast (gtype.c:3994)
==15182==    by 0x537EA55: folks_persona_get_individual (persona.vala:154)
==15182==    by 0x53611B7: _folks_individual_disconnect_from_persona (individual.vala:1625)
==15182==    by 0x5364A14: _folks_individual_set_personas (individual.vala:1969)
==15182==    by 0x536633A: folks_individual_set_personas (individual.vala:799)
==15182==    by 0x53727AE: _folks_individual_aggregator_personas_changed_cb (individual-aggregator.vala:1345)
==15182==    by 0x536C69A: __folks_individual_aggregator_personas_changed_cb_folks_persona_store_personas_changed (individual-aggregator.vala:758)
==15182==    by 0x5380621: g_cclosure_user_marshal_VOID__OBJECT_OBJECT_STRING_OBJECT_ENUM (persona-store.vala:281)
==15182==    by 0x7015F0F: g_closure_invoke (gclosure.c:777)
==15182==    by 0x7033567: signal_emit_unlocked_R (gsignal.c:3547)
==15182==    by 0x70327BB: g_signal_emit_valist (gsignal.c:3295)
==15182==    by 0x7032E8C: g_signal_emit_by_name (gsignal.c:3389)
==15182==    by 0x537F9CC: _folks_persona_store_emit_personas_changed (persona-store.vala:395)
==15182==    by 0x50FBFF7: _tpf_persona_store_notify_connection_cb (tpf-persona-store.vala:862)
==15182==    by 0x50F9E1D: __tpf_persona_store_notify_connection_cb_g_object_notify (tpf-persona-store.vala:641)
==15182==    by 0x701A46C: g_cclosure_marshal_VOID__PARAM (gmarshal.c:1042)
==15182==    by 0x7015F0F: g_closure_invoke (gclosure.c:777)
==15182==    by 0x7033567: signal_emit_unlocked_R (gsignal.c:3547)
==15182==    by 0x70327BB: g_signal_emit_valist (gsignal.c:3295)
==15182==    by 0x7032D2E: g_signal_emit (gsignal.c:3352)
==15182==  Address 0x19cb8a30 is 0 bytes inside a block of size 320 free'd
==15182==    at 0x4A0662E: free (vg_replace_malloc.c:366)
==15182==    by 0x72BB782: standard_free (gmem.c:98)
==15182==    by 0x72BB92B: g_free (gmem.c:252)
==15182==    by 0x72D32EA: g_slice_free1 (gslice.c:1111)
==15182==    by 0x7038584: g_type_free_instance (gtype.c:1937)
==15182==    by 0x7022418: g_object_unref (gobject.c:3031)
==15182==    by 0x44DAC3: dispose (empathy-individual-menu.c:881)
==15182==    by 0x70222AB: g_object_unref (gobject.c:2981)
==15182==    by 0x5FFE33F: gtk_menu_detach (gtkmenu.c:1299)
==15182==    by 0x600DC57: gtk_menu_item_set_submenu (gtkmenuitem.c:1228)
==15182==    by 0x430AC3: chat_window_contact_menu_update (empathy-chat-window.c:593)
==15182==    by 0x431014: chat_window_update (empathy-chat-window.c:774)
==15182==    by 0x4317B2: chat_window_update_chat_tab_full (empathy-chat-window.c:964)
==15182==    by 0x4317E0: chat_window_update_chat_tab (empathy-chat-window.c:973)
==15182==    by 0x4318DB: chat_window_chat_notify_cb (empathy-chat-window.c:1005)
==15182==    by 0x701A46C: g_cclosure_marshal_VOID__PARAM (gmarshal.c:1042)
==15182==    by 0x7015F0F: g_closure_invoke (gclosure.c:777)
==15182==    by 0x7033567: signal_emit_unlocked_R (gsignal.c:3547)
==15182==    by 0x70327BB: g_signal_emit_valist (gsignal.c:3295)
==15182==    by 0x7032D2E: g_signal_emit (gsignal.c:3352)
==15182== 

GLib-GObject-WARNING **: invalid unclassed pointer in cast to `FolksIndividual'
==15182== Invalid read of size 8
==15182==    at 0x53662CE: folks_individual_get_personas (individual.vala:798)
==15182==    by 0x537EA5D: folks_persona_get_individual (persona.vala:154)
==15182==    by 0x53611B7: _folks_individual_disconnect_from_persona (individual.vala:1625)
==15182==    by 0x5364A14: _folks_individual_set_personas (individual.vala:1969)
==15182==    by 0x536633A: folks_individual_set_personas (individual.vala:799)
==15182==    by 0x53727AE: _folks_individual_aggregator_personas_changed_cb (individual-aggregator.vala:1345)
==15182==    by 0x536C69A: __folks_individual_aggregator_personas_changed_cb_folks_persona_store_personas_changed (individual-aggregator.vala:758)
==15182==    by 0x5380621: g_cclosure_user_marshal_VOID__OBJECT_OBJECT_STRING_OBJECT_ENUM (persona-store.vala:281)
==15182==    by 0x7015F0F: g_closure_invoke (gclosure.c:777)
==15182==    by 0x7033567: signal_emit_unlocked_R (gsignal.c:3547)
==15182==    by 0x70327BB: g_signal_emit_valist (gsignal.c:3295)
==15182==    by 0x7032E8C: g_signal_emit_by_name (gsignal.c:3389)
==15182==    by 0x537F9CC: _folks_persona_store_emit_personas_changed (persona-store.vala:395)
==15182==    by 0x50FBFF7: _tpf_persona_store_notify_connection_cb (tpf-persona-store.vala:862)
==15182==    by 0x50F9E1D: __tpf_persona_store_notify_connection_cb_g_object_notify (tpf-persona-store.vala:641)
==15182==    by 0x701A46C: g_cclosure_marshal_VOID__PARAM (gmarshal.c:1042)
==15182==    by 0x7015F0F: g_closure_invoke (gclosure.c:777)
==15182==    by 0x7033567: signal_emit_unlocked_R (gsignal.c:3547)
==15182==    by 0x70327BB: g_signal_emit_valist (gsignal.c:3295)
==15182==    by 0x7032D2E: g_signal_emit (gsignal.c:3352)
==15182==  Address 0x19cb8a48 is 24 bytes inside a block of size 320 free'd
==15182==    at 0x4A0662E: free (vg_replace_malloc.c:366)
==15182==    by 0x72BB782: standard_free (gmem.c:98)
==15182==    by 0x72BB92B: g_free (gmem.c:252)
==15182==    by 0x72D32EA: g_slice_free1 (gslice.c:1111)
==15182==    by 0x7038584: g_type_free_instance (gtype.c:1937)
==15182==    by 0x7022418: g_object_unref (gobject.c:3031)
==15182==    by 0x44DAC3: dispose (empathy-individual-menu.c:881)
==15182==    by 0x70222AB: g_object_unref (gobject.c:2981)
==15182==    by 0x5FFE33F: gtk_menu_detach (gtkmenu.c:1299)
==15182==    by 0x600DC57: gtk_menu_item_set_submenu (gtkmenuitem.c:1228)
==15182==    by 0x430AC3: chat_window_contact_menu_update (empathy-chat-window.c:593)
==15182==    by 0x431014: chat_window_update (empathy-chat-window.c:774)
==15182==    by 0x4317B2: chat_window_update_chat_tab_full (empathy-chat-window.c:964)
==15182==    by 0x4317E0: chat_window_update_chat_tab (empathy-chat-window.c:973)
==15182==    by 0x4318DB: chat_window_chat_notify_cb (empathy-chat-window.c:1005)
==15182==    by 0x701A46C: g_cclosure_marshal_VOID__PARAM (gmarshal.c:1042)
==15182==    by 0x7015F0F: g_closure_invoke (gclosure.c:777)
==15182==    by 0x7033567: signal_emit_unlocked_R (gsignal.c:3547)
==15182==    by 0x70327BB: g_signal_emit_valist (gsignal.c:3295)
==15182==    by 0x7032D2E: g_signal_emit (gsignal.c:3352)
==15182== 
==15182== Invalid read of size 8
==15182==    at 0x53662D2: folks_individual_get_personas (individual.vala:798)
==15182==    by 0x537EA5D: folks_persona_get_individual (persona.vala:154)
==15182==    by 0x53611B7: _folks_individual_disconnect_from_persona (individual.vala:1625)
==15182==    by 0x5364A14: _folks_individual_set_personas (individual.vala:1969)
==15182==    by 0x536633A: folks_individual_set_personas (individual.vala:799)
==15182==    by 0x53727AE: _folks_individual_aggregator_personas_changed_cb (individual-aggregator.vala:1345)
==15182==    by 0x536C69A: __folks_individual_aggregator_personas_changed_cb_folks_persona_store_personas_changed (individual-aggregator.vala:758)
==15182==    by 0x5380621: g_cclosure_user_marshal_VOID__OBJECT_OBJECT_STRING_OBJECT_ENUM (persona-store.vala:281)
==15182==    by 0x7015F0F: g_closure_invoke (gclosure.c:777)
==15182==    by 0x7033567: signal_emit_unlocked_R (gsignal.c:3547)
==15182==    by 0x70327BB: g_signal_emit_valist (gsignal.c:3295)
==15182==    by 0x7032E8C: g_signal_emit_by_name (gsignal.c:3389)
==15182==    by 0x537F9CC: _folks_persona_store_emit_personas_changed (persona-store.vala:395)
==15182==    by 0x50FBFF7: _tpf_persona_store_notify_connection_cb (tpf-persona-store.vala:862)
==15182==    by 0x50F9E1D: __tpf_persona_store_notify_connection_cb_g_object_notify (tpf-persona-store.vala:641)
==15182==    by 0x701A46C: g_cclosure_marshal_VOID__PARAM (gmarshal.c:1042)
==15182==    by 0x7015F0F: g_closure_invoke (gclosure.c:777)
==15182==    by 0x7033567: signal_emit_unlocked_R (gsignal.c:3547)
==15182==    by 0x70327BB: g_signal_emit_valist (gsignal.c:3295)
==15182==    by 0x7032D2E: g_signal_emit (gsignal.c:3352)
==15182==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
Comment 2 Guillaume Desmottes 2012-03-19 10:53:07 UTC
To be more precise, it crashes because persona's self->priv->_individual is pointing to a destroyed individual.

The individual is destroyed in dispose (object=0xb667a0) at empathy-individual-menu.c:881 but this menu doesn't seem to steal a reference so that's probably another place which unref a reference it doesn't own. :\
Comment 3 Guillaume Desmottes 2012-03-19 13:22:34 UTC
Created attachment 210088 [details] [review]
Persona: make sure to NULL-ify the individual when it's destroyed
Comment 4 Philip Withnall 2012-03-19 13:24:49 UTC
Review of attachment 210088 [details] [review]:

::: folks/persona.vala
@@ +170,3 @@
 
+          if (value != null)
+            value.weak_ref (this._individual_weak_notify_cb);

Needs a corresponding weak_unref() call.

Also, please put braces around the body of the if-block (even though it's only one line).
Comment 5 Guillaume Desmottes 2012-03-19 13:29:43 UTC
Created attachment 210089 [details] [review]
Persona: make sure to NULL-ify the individual when it's destroyed
Comment 6 Philip Withnall 2012-03-19 13:36:34 UTC
Review of attachment 210089 [details] [review]:

Looks good to me. Please commit to master with the modification below.

::: folks/persona.vala
@@ +348,3 @@
+        {
+          this._individual.weak_unref (this._individual_weak_notify_cb);
+        }

Might be tidier to just have this.individual = null here, then all the weak_[ref|unref]() stuff stays inside the individual property.
Comment 7 Guillaume Desmottes 2012-03-19 13:41:40 UTC
Created attachment 210091 [details] [review]
Persona: make sure to NULL-ify the individual when it's destroyed
Comment 8 Philip Withnall 2012-03-19 13:43:12 UTC
Review of attachment 210091 [details] [review]:

Make it so!
Comment 9 Guillaume Desmottes 2012-03-19 13:44:45 UTC
Attachment 210091 [details] pushed as 11b837a - Persona: make sure to NULL-ify the individual when it's destroyed