diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2012-07-02 15:24:22 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2012-11-16 10:08:45 +0000 |
commit | 973bff2a35600a56ef8a4afb49a6a0d5df4a384a (patch) | |
tree | c56034b2fb7c866a60b4b9d908fe61fb3e448262 | |
parent | 6199eab3f074c3159b31389a37e432bf9f69cd76 (diff) | |
download | telepathy-salut-973bff2a35600a56ef8a4afb49a6a0d5df4a384a.tar.gz |
Don't crash when closing a roomlist channel.
TpBaseChannel requires that the 'close' vfunc be implemented, even if
the implementation is literally tp_base_channel_destroyed() because
there is no clean-up to do. As a result, Empathy pre-emptively
requesting a roomlist channel when you open the Join Room… dialog would
crash Salut when you close that dialog.
-rw-r--r-- | src/roomlist-channel.c | 1 | ||||
-rw-r--r-- | tests/twisted/avahi/roomlist.py | 26 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/roomlist-channel.c b/src/roomlist-channel.c index 566db977..2faa0f9f 100644 --- a/src/roomlist-channel.c +++ b/src/roomlist-channel.c @@ -135,6 +135,7 @@ salut_roomlist_channel_class_init ( base_class->target_handle_type = TP_HANDLE_TYPE_NONE; base_class->fill_immutable_properties = salut_roomlist_channel_fill_immutable_properties; + base_class->close = tp_base_channel_destroyed; param_spec = g_param_spec_string ("conference-server", "Name of conference server to use", diff --git a/tests/twisted/avahi/roomlist.py b/tests/twisted/avahi/roomlist.py index f5ffd85e..01e32da7 100644 --- a/tests/twisted/avahi/roomlist.py +++ b/tests/twisted/avahi/roomlist.py @@ -10,7 +10,8 @@ from twisted.words.xish import domish from saluttest import exec_test, wait_for_contact_list from servicetest import call_async, EventPattern, \ - tp_name_prefix, tp_path_prefix, make_channel_proxy + tp_name_prefix, tp_path_prefix, wrap_channel +import constants as cs CHANNEL_TYPE_ROOMLIST = 'org.freedesktop.Telepathy.Channel.Type.RoomList' @@ -47,7 +48,7 @@ def test(q, bus, conn): ) path1 = ret.value[0] - chan = make_channel_proxy(conn, path1, "Channel.Type.RoomList") + chan = wrap_channel(bus.get_object(conn.bus_name, path1), "RoomList") assert new_sig.args[0][0][0] == path1 @@ -71,7 +72,7 @@ def test(q, bus, conn): assert old_sig.args[4] == 1 # suppress handler # Exercise basic Channel Properties from spec 0.17.7 - channel_props = chan.GetAll( + channel_props = chan.Properties.GetAll( tp_name_prefix + '.Channel', dbus_interface='org.freedesktop.DBus.Properties') assert channel_props.get('TargetHandle') == 0,\ @@ -90,7 +91,7 @@ def test(q, bus, conn): dbus_interface='org.freedesktop.DBus.Properties') == '' # list rooms - chan.ListRooms() + chan.RoomList.ListRooms() q.expect('dbus-signal', signal='ListingRooms', args=[True]) @@ -119,7 +120,7 @@ def test(q, bus, conn): EventPattern('dbus-signal', signal='NewChannels'), ) path2 = ret.value[0] - chan = make_channel_proxy(conn, path2, "Channel.Type.RoomList") + chan2 = wrap_channel(bus.get_object(conn.bus_name, path2), "RoomList") props = ret.value[1] assert props[tp_name_prefix + '.Channel.ChannelType'] ==\ @@ -143,9 +144,7 @@ def test(q, bus, conn): assert old_sig.args[3] == 0 # handle assert old_sig.args[4] == 1 # suppress handler - assert chan.Get( - CHANNEL_TYPE_ROOMLIST, 'Server', - dbus_interface='org.freedesktop.DBus.Properties') == '' + assert chan2.Properties.Get(CHANNEL_TYPE_ROOMLIST, 'Server') == '' # ensure roomlist channel yours, ensured_path, ensured_props = requestotron.EnsureChannel( @@ -157,15 +156,20 @@ def test(q, bus, conn): assert not yours assert ensured_path == path2, (ensured_path, path2) + # Closing roomlist channels crashed Salut for a while. + chan2.Close() + q.expect_many( + EventPattern('dbus-signal', signal='Closed', + path=path2), + EventPattern('dbus-signal', signal='ChannelClosed', args=[path2]), + ) + conn.Disconnect() q.expect_many( EventPattern('dbus-signal', signal='Closed', path=path1), - EventPattern('dbus-signal', signal='Closed', - path=path2), EventPattern('dbus-signal', signal='ChannelClosed', args=[path1]), - EventPattern('dbus-signal', signal='ChannelClosed', args=[path2]), EventPattern('dbus-signal', signal='StatusChanged', args=[2, 1]), ) |