Bug 13896

Summary: "invalid property" warning when requesting a channel
Product: Telepathy Reporter: Alban Crequy <alban.crequy>
Component: generalAssignee: Simon McVittie <smcv>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: ollisal
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: You need no-op code similar to this in the _set_property callback of each TpChannelIface implementation

Description Alban Crequy 2008-01-02 09:47:04 UTC
Version: last darcs version from today

How to reproduce:
- double click on an offline contact in Empathy
- gabble reports the following warning:

** (telepathy-gabble:26126): WARNING **: gabble-im-channel.c:199: invalid property id 2 for "channel-type" of type `GParamString' in `GabbleIMChannel'

The D-Bus method involved is RequestChannel. This is a "Text" channel. Similar bug when I request channel of type "Tube" on an offline contact:

** (telepathy-gabble:13613): WARNING **: tubes-channel.c:248: invalid property id 2 for "channel-type" of type `GParamString' in `GabbleTubesChannel'

There is no problem when the contact is online.

I added a trace in gabble_im_channel_set_property(). Gabble display the following traces when I double-click on an offline contact in Empathy:

** (telepathy-gabble:30006): DEBUG: channel_request_new: New channel request at 0x6af940: ctype=org.freedesktop.Telepathy.Channel.Type.Text htype=1 handle=3 suppress=1
** (telepathy-gabble:30006): DEBUG: gabble_im_channel_set_property: set property id=PROP_CONNECTION:
** (telepathy-gabble:30006): DEBUG: gabble_im_channel_set_property: set property id=PROP_OBJECT_PATH:
** (telepathy-gabble:30006): DEBUG: gabble_im_channel_set_property: set property id=PROP_HANDLE:
** (telepathy-gabble:30006): DEBUG: gabble_im_channel_set_property: set property id=2:
** (telepathy-gabble:30006): WARNING **: gabble-im-channel.c:204: invalid property id 2 for "channel-type" of type `GParamString' in `GabbleIMChannel'

I cannot reproduce the bug with the packaged version telepathy-gabble-0.7.0-1 from http://ppa.launchpad.net/telepathy/ubuntu
Comment 1 Alban Crequy 2008-01-02 13:34:08 UTC
Contrary to what I said, the warning also appear on previous versions, and with online contacts.

The object gabble_im_channel_class contains 5 properties: connection,
object-path, handle, channel-type and handle-type. But only 3 are initialized
here:

im-factory.c:new_im_channel():
  chan = g_object_new (GABBLE_TYPE_IM_CHANNEL,
                       "connection", priv->conn,
                       "object-path", object_path,
                       "handle", handle,
                       NULL);

g_object_new() calls the constructor with properties as parameters:

gabble-im-channel.c:gabble_im_channel_constructor():
  gabble_im_channel_constructor (GType type, guint n_props,
                                 GObjectConstructParam *props)
  {
    [...]
    obj = G_OBJECT_CLASS (gabble_im_channel_parent_class)->
             constructor (type, n_props, props);

However, the constructor receives values for all 5 properties, and not only the
3 from g_object_new(), because according to (*), construction parameters which
are not explicitly specified are set to their default values.

(*) http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-new

The warning can be removed with:

--- old-telepathy-gabble-cassidy/src/gabble-im-channel.c        2008-01-02 22:24:50.000000000 +0100
+++ new-telepathy-gabble-cassidy/src/gabble-im-channel.c        2008-01-02 22:24:50.000000000 +0100
@@ -180,6 +180,12 @@
       g_free (priv->object_path);
       priv->object_path = g_value_dup_string (value);
       break;
+    case PROP_CHANNEL_TYPE:
+      /* The channel type is a constant: TP_IFACE_CHANNEL_TYPE_TEXT and must
+       * not be changed. However, g_object_new() set all properties, so we get
+       * called to change the property PROP_CHANNEL_TYPE.
+       */
+      break;
     case PROP_HANDLE:
       /* we don't ref it here because we don't necessarily have access to the
        * contact repo yet - instead we ref it in the constructor.
Comment 2 Simon McVittie 2008-01-03 04:45:48 UTC
This warning is fairly harmless; it's caused by having a bleeding-edge version of telepathy-glib, which changes the channel type from read-only to read/write. The other GLib connection managers will have the same bug. I'll make sure to fix them all before releasing the current darcs telepathy-glib.

Note that darcs versions of telepathy-glib have no API or ABI stability guarantees - we only guarantee that ABI will not be broken once it has appeared in a release of telepathy-glib. You'll have to recompile (or at least relink) Empathy and any other locally compiled Telepathy components when you upgrade to a released version of telepathy-glib.
Comment 3 Simon McVittie 2008-01-04 05:06:31 UTC
Created attachment 13516 [details] [review]
You need no-op code similar to this in the _set_property callback of each TpChannelIface implementation

Fixed in darcs for Gabble, Salut, Haze. Similar patches queued for review for Idle and telepathy-sofiasip, and I'll file a bug against gnome-phone-manager.

If anyone else encounters this problem, the solution is to check all your implementations of TpChannelIface to make sure they won't warn when the channel-type property is written. Having the set callback be a no-op for the channel type, like it often already is for the handle type, is the simplest solution (see attached).
Comment 4 Simon McVittie 2008-01-04 05:19:15 UTC
The same bug in gnome-phone-manager: http://bugzilla.gnome.org/show_bug.cgi?id=507258
Comment 5 Olli Salli 2008-01-15 11:16:59 UTC
Merged to idle darcs head.
Comment 6 Simon McVittie 2008-01-16 10:13:25 UTC
OK, I think we've fixed this in HEAD of all the CMs...

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.