On Thu, 2007-10-04 at 16:37 +0930, Iain Buchanan wrote:
> On Thu, 2007-10-04 at 07:17 +0100, Mark Ellis wrote:
> > On Thu, 2007-10-04 at 05:20 +0000, Iain Buchanan wrote:
> > > > Try the attached patch, hopefully it will prevent the segfault. If that
> > > > works ok we can start to figure out why the connection is a bit flaky.
> > > 
> > > heh... still crashes:
> > 
> > > I've attached the backtrace.
> > > 
> > 
> > That backtrace could be remarkably useful, try the new patch attached. 
> 
> Don't have time to analyse this one (not so good at it anyway) as I'm
> about to go...
> 
> here is the output, backtrace attached.
> 
> ** (synce-trayicon:26141): DEBUG: odccm_device_connected_cb: Received
> connect from
> odccm: /org/synce/odccm/Device/_2C343682_C645_9887_675F_401F60866DD0_
> 
> ** (synce-trayicon:26141): CRITICAL **: get_device_name_via_rapi:
> CeRegOpenKeyEx failed getting device name
> *** glibc detected *** synce-trayicon: free(): invalid pointer:
> 0x080e9b78 ***
> 
> may not be able to get on to it again till tomorrow - have to ride home
> now :)
> 
> thanks & cya,

Try this one.

Mark

diff -Nur synce-trayicon-0.9.0.svn20071002.orig/src/device.c synce-trayicon-0.9.0.svn20071002/src/device.c
--- synce-trayicon-0.9.0.svn20071002.orig/src/device.c	2007-08-23 09:22:00.000000000 +0100
+++ synce-trayicon-0.9.0.svn20071002/src/device.c	2007-10-04 07:11:28.000000000 +0100
@@ -740,9 +740,11 @@
 
   /* unref other objects */
 
-  rapi_connection_select(priv->rapi_conn);
-  CeRapiUninit();
-  rapi_connection_destroy(priv->rapi_conn);
+  if (priv->rapi_conn) {
+    rapi_connection_select(priv->rapi_conn);
+    CeRapiUninit();
+    rapi_connection_destroy(priv->rapi_conn);
+  }
 
   if (G_OBJECT_CLASS (wm_device_parent_class)->dispose)
     G_OBJECT_CLASS (wm_device_parent_class)->dispose (obj);
diff -Nur synce-trayicon-0.9.0.svn20071002.orig/src/odccm-client.c synce-trayicon-0.9.0.svn20071002/src/odccm-client.c
--- synce-trayicon-0.9.0.svn20071002.orig/src/odccm-client.c	2007-08-23 09:22:00.000000000 +0100
+++ synce-trayicon-0.9.0.svn20071002/src/odccm-client.c	2007-10-05 07:18:03.000000000 +0100
@@ -260,19 +260,21 @@
     rapi_connection_destroy(rapi_conn);
     goto error_exit;;
   }
-  g_object_set(device, "rapi-conn", rapi_conn, NULL);
 
   device_name = get_device_name_via_rapi();
   if (!(device_name)) {
     CeRapiUninit();
+    rapi_connection_destroy(rapi_conn);
     goto error_exit;
   }
 
+  g_object_set(device, "rapi-conn", rapi_conn, NULL);
   g_object_set(device, "device-name", device_name, NULL);
   g_free(device_name);
 
   return TRUE;
 error_exit:
+  synce_info_destroy(info);
   return FALSE;
 }
 
@@ -411,13 +413,6 @@
     goto error_exit;
   }
 
-  g_object_get(device, "name", &name, NULL);
-  proxy_store *p_store = g_malloc0(sizeof(proxy_store));
-  p_store->pdaname = g_strdup(name);
-  p_store->proxy = new_proxy;
-
-  g_ptr_array_add(priv->dev_proxies, p_store);
-
   dbus_g_proxy_add_signal (new_proxy, "PasswordFlagsChanged",
 			   G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
   dbus_g_proxy_connect_signal (new_proxy, "PasswordFlagsChanged",
@@ -432,6 +427,13 @@
     goto error_exit;
   }
 
+  g_object_get(device, "name", &name, NULL);
+  proxy_store *p_store = g_malloc0(sizeof(proxy_store));
+  p_store->pdaname = g_strdup(name);
+  p_store->proxy = new_proxy;
+
+  g_ptr_array_add(priv->dev_proxies, p_store);
+
   if (password_flags & ODCCM_DEVICE_PASSWORD_FLAG_PROVIDE) {
     g_hash_table_insert(priv->pending_devices, g_strdup(name), device);
     g_signal_emit (self, DCCM_CLIENT_GET_INTERFACE (self)->signals[PASSWORD_REQUIRED], 0, name);
@@ -439,8 +441,12 @@
   }
 
   /* get rapi connection */
-  if (!(odccm_device_get_rapi_connection(self, device)))
-     goto error_exit;
+  if (!(odccm_device_get_rapi_connection(self, device))) {
+    g_ptr_array_remove(priv->dev_proxies, p_store);
+    g_free(p_store->pdaname);
+    g_free(p_store);
+    goto error_exit;
+  }
 
   g_signal_emit(self, DCCM_CLIENT_GET_INTERFACE (self)->signals[DEVICE_CONNECTED], 0, name, (gpointer)device);
   g_free(name);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
SynCE-Devel mailing list
SynCE-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synce-devel

Reply via email to