[Bug 25019] New: tp_presence_mixin_emit_presence_update() segfaults if TP_TYPE_SVC_CONNECTION_INTERFACE_PRESENCE is not implemented

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Nov 10 17:14:12 CET 2009


http://bugs.freedesktop.org/show_bug.cgi?id=25019

           Summary: tp_presence_mixin_emit_presence_update() segfaults if
                    TP_TYPE_SVC_CONNECTION_INTERFACE_PRESENCE is not
                    implemented
           Product: Telepathy
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: tp-glib
        AssignedTo: telepathy-bugs at lists.freedesktop.org
        ReportedBy: ext-butch.howard at nokia.com


Since INTERFACE_PRESENCE is deprecated, it implies that it is not necessary to
implement that interface. However, if it is not implemented (even though the
TpPresenceMixin does all the work for us it is not clear that it should be
used), then a call to tp_presence_mixin_emit_presence_update() will cause a
segfault when the internals of
tp_svc_connection_interface_presence_emit_presence_update() type check the
GOBJECT for the requested interface.

A simple fix for this is to wrap the call in a test similar to that done a few
lines below for the call for the Simple Presence emit so that the function is
not called unless the Presence interface is implemented.

Updated Code:

void
tp_presence_mixin_emit_presence_update (GObject *obj,
                                        GHashTable *contact_statuses)
{
  TpPresenceMixinClass *mixin_cls =
    TP_PRESENCE_MIXIN_CLASS (G_OBJECT_GET_CLASS (obj));
  GHashTable *presence_hash;

  DEBUG ("called.");

  if (g_type_interface_peek (G_OBJECT_GET_CLASS (obj),
                  TP_TYPE_SVC_CONNECTION_INTERFACE_PRESENCE) != NULL)
    {
          presence_hash = construct_presence_hash (mixin_cls->statuses,
                  contact_statuses);
          tp_svc_connection_interface_presence_emit_presence_update (obj,
                  presence_hash);

          g_hash_table_destroy (presence_hash);
    }

  if (g_type_interface_peek (G_OBJECT_GET_CLASS (obj),
      TP_TYPE_SVC_CONNECTION_INTERFACE_SIMPLE_PRESENCE) != NULL)
    {
      presence_hash = construct_simple_presence_hash (mixin_cls->statuses,
        contact_statuses);
      tp_svc_connection_interface_simple_presence_emit_presences_changed (obj,
        presence_hash);

      g_hash_table_destroy (presence_hash);
    }
}


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the telepathy-bugs mailing list