[Telepathy-commits] [telepathy-idle/master] Fix a test crash in connect/server-quit-ignore.py

Jonathon Jongsma jonathon.jongsma at collabora.co.uk
Tue Feb 17 12:58:32 PST 2009


This test was only failing when I ran the full test suite, not when I ran the
test by itself.  Running under valgrind indicated that my _force_disconnect()
timeout function was attempting to use an already-freed object:

    ==19693== Invalid read of size 8
    ==19693==    at 0x52B02AC: g_type_check_instance_cast (in /usr/lib/libgobject-2.0.so.0.1800.4)
    ==19693==    by 0x407719: _force_disconnect (idle-connection.c:438)
    ==19693==    by 0x55042BA: (within /usr/lib/libglib-2.0.so.0.1800.4)
    ==19693==    by 0x5503AFA: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.1800.4)
    ==19693==    by 0x55072BC: (within /usr/lib/libglib-2.0.so.0.1800.4)
    ==19693==    by 0x55077EC: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.1800.4)
    ==19693==    by 0x5E0A9C5: tp_run_connection_manager (run.c:264)
    ==19693==    by 0x406504: main (idle.c:38)
    ==19693==  Address 0x6cd3258 is 0 bytes inside a block of size 328 free'd
    ==19693==    at 0x4C2161F: free (vg_replace_malloc.c:323)
    ==19693==    by 0x52B17BA: g_type_free_instance (in /usr/lib/libgobject-2.0.so.0.1800.4)
    ==19693==    by 0x52B45C2: g_value_unset (in /usr/lib/libgobject-2.0.so.0.1800.4)
    ==19693==    by 0x52A7207: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.1800.4)
    ==19693==    by 0x52A76D2: g_signal_emit (in /usr/lib/libgobject-2.0.so.0.1800.4)
    ==19693==    by 0x4076F5: _finish_shutdown_idle_func (idle-connection.c:430)
    ==19693==    by 0x5503AFA: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.1800.4)
    ==19693==    by 0x55072BC: (within /usr/lib/libglib-2.0.so.0.1800.4)
    ==19693==    by 0x55077EC: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.1800.4)
    ==19693==    by 0x5E0A9C5: tp_run_connection_manager (run.c:264)
    ==19693==    by 0x406504: main (idle.c:38)

    GLib-GObject-WARNING **: invalid unclassed pointer in cast to `IdleConnection'
    aborting...

Cancelling the timeout when shutting down the connection seems to fix it.  Now
all tests pass again \o/
---
 src/idle-connection.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/idle-connection.c b/src/idle-connection.c
index 6c2d645..7a6f6c7 100644
--- a/src/idle-connection.c
+++ b/src/idle-connection.c
@@ -420,6 +420,10 @@ static gchar *_iface_get_unique_connection_name(TpBaseConnection *self) {
 
 static gboolean _finish_shutdown_idle_func(gpointer data) {
 	TpBaseConnection *conn = TP_BASE_CONNECTION(data);
+	IdleConnectionPrivate *priv = IDLE_CONNECTION_GET_PRIVATE(conn);
+	if (priv->force_disconnect_id != 0) {
+		g_source_remove(priv->force_disconnect_id);
+	}
 
 	tp_base_connection_finish_shutdown(conn);
 
-- 
1.5.6.5



More information about the telepathy-commits mailing list