[maemo-commits] [maemo-commits] r15325 - projects/connectivity/osso-gwobex/trunk/src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Mar 31 14:11:56 EEST 2008
Author: jh
Date: 2008-03-31 14:11:51 +0300 (Mon, 31 Mar 2008)
New Revision: 15325

Modified:
   projects/connectivity/osso-gwobex/trunk/src/obex-xfer.c
Log:
Don't try to access xfer object after the user callback since it might have gotten free'd

Modified: projects/connectivity/osso-gwobex/trunk/src/obex-xfer.c
===================================================================
--- projects/connectivity/osso-gwobex/trunk/src/obex-xfer.c	2008-03-27 12:21:47 UTC (rev 15324)
+++ projects/connectivity/osso-gwobex/trunk/src/obex-xfer.c	2008-03-31 11:11:51 UTC (rev 15325)
@@ -136,22 +136,24 @@
 }
 
 static gboolean gw_obex_put_idle(GwObexXfer *xfer) {
+    struct gw_obex *ctx = xfer->ctx;
+
     g_source_destroy(xfer->idle_source);
     xfer->idle_source = NULL;
 
-    if (!xfer->ctx)
+    if (!ctx)
         return FALSE;
 
-    GW_OBEX_LOCK(xfer->ctx);
+    GW_OBEX_LOCK(ctx);
 
     if (xfer->cb && xfer->do_cb) {
         xfer->do_cb = FALSE;
-        GW_OBEX_UNLOCK(xfer->ctx);
+        GW_OBEX_UNLOCK(ctx);
         xfer->cb(xfer, xfer->cb_data);
-        GW_OBEX_LOCK(xfer->ctx);
+        GW_OBEX_LOCK(ctx);
     }
 
-    GW_OBEX_UNLOCK(xfer->ctx);
+    GW_OBEX_UNLOCK(ctx);
 
     return FALSE;
 }


More information about the maemo-commits mailing list