On Thu, 2007-09-27 at 18:20 +0100, Mark Ellis wrote:
> On Thu, 2007-09-27 at 10:58 +0930, Iain Buchanan wrote:
> > Hi all!
> > 
> > I load trayicon and then plug in my device.  It then segfaults at line
> > 630 of odccm-client.c:

[snip]

> Does it always do this, or is it intermittent ? 

It always segfaults, yes.

> Unfortunately I don't
> have time at the moment to do much, but I'll give you some ideas in case
> you can try yourself.

I _can_ try myself, but that doesn't mean I'll get anywhere :)

 I'm having a hard time getting the line number from gdb though... it
may in fact be from line 451, since odccm_device_get_rapi_connection is
called from two places.  This is line 451:

  goto exit;
error_exit:
  g_object_unref(new_proxy);
  if (device) g_object_unref(device); // here!
exit:
  return;
}

It seems that get_device_name_via_rapi fails with the message
"CeRegOpenKeyEx failed getting device name", and so returns NULL.  And
because that fails, odccm_device_get_rapi_connection returns FALSE, and
therefore odccm_device_connected_cb tries to g_object_unref(device).

If I comment out this line "if (device) g_object_unref(device);" then
trayicon doesn't segfault, but it still doesn't detect the device when I
plug it in (makes sense).  However, it _does_ detect the name when I
unplug it.  Attached is the output with the unref line commented, with
some line breaks just before I plugged the device in, and just before I
unplugged it.

That's about as far as I got...

> I suspect there are two different problems, one that causes the name
> lookup failure below, and another that causes a segfault when unreffing
> the device object.

I think it's because it can't get the name that it causes this chain of
events.

> Taking the unref action, my best guess is that when the object is
> finalized in device.c, it tries to free an invalid pointer.
> 
> Not enough information to speculate on the name lookup failure. What
> dccm are you using ? Any useful output from it ?

odccm.  It shows this when I plug in my device:

** (odccm:30213): DEBUG: device_info_received
** (odccm:30213): DEBUG: 82 36 34 2c 45 c6 87 98 67 5f 40 1f 60 86 6d d0
05 00 00 00 01 00 00 00 03 00 00 00 49 00 4f 00 32 00 00 00 05 01 c3 00
11 0a 00 00 05 00 00 00 7e f7 98 00 5c 38 ce 60 0f 00 00 00 50 6f 63 6b
65 74 50 43 00 53 53 44 4b 00 00 08 00 00 00 58 64 61 20 41 74 6f 6d 00
02 00 00 00 04 00 00 00 00 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00
** (odccm:30213): DEBUG: device_info_received: registering object path
'/org/synce/odccm/Device/_2C343682_C645_9887_675F_401F60866DD0_'

the hex translates to this:

�64,[EMAIL PROTECTED]
~��\8�`PocketPCSSDXda Atom

IO2 is my devices name, and it is an Xda.  So odccm is seeing the name.

trayicon gets the same device info string:

** (synce-trayicon:26369): DEBUG: odccm_device_connected_cb: Received
connect from
odccm: /org/synce/odccm/Device/_2C343682_C645_9887_675F_401F60866DD0_

[snip]

> Hmm, I might make the -f option not connect to the session manager,
> would stop unexpected restarts when debugging.
> 
> > And also, once it has restarted, it doesn't recognise my device.
> > 
> > Any suggestions?  thanks!
> 
> It won't recognise an already connected device on startup, it's on my
> (growing) list :)

Try the attached patch to main.c for not restarting when the -f option
is specified.  There are lots of ways it could have been done, this is
just one :)

What else on your todo list is this easy?!!

Well, sorry about the huge email, but thanks for any help you can
continue to provide!
-- 
Iain Buchanan <iaindb at netspace dot net dot au>

"Just Say No."   - Nancy Reagan

"No."            - Ronald Reagan
--- main.c	2007-09-28 12:16:08.000000000 +0930
+++ main-norestart.c	2007-09-28 12:09:47.000000000 +0930
@@ -51,7 +51,7 @@
 
 
 static void
-init_sm ()
+init_sm (bool restart_immediately)
 {
     GnomeClient *master;
     GnomeClientFlags flags;
@@ -59,8 +59,10 @@
     master = gnome_master_client ();
     flags = gnome_client_get_flags (master);
     if (flags & GNOME_CLIENT_IS_CONNECTED) {
-        gnome_client_set_restart_style (master,
-                GNOME_RESTART_IMMEDIATELY);
+       if (restart_immediately)
+          gnome_client_set_restart_style (master, GNOME_RESTART_IMMEDIATELY);
+       else
+          gnome_client_set_restart_style (master, GNOME_RESTART_NEVER);
         gnome_client_flush (master);
     }
                                                                                 
@@ -100,6 +102,7 @@
 {
 	int result = 1;
 	SynceTrayIcon *trayicon;
+   bool restart;
 
 #ifdef ENABLE_NLS
 	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
@@ -126,15 +129,17 @@
 		synce_log_use_syslog();
 		g_debug("Forking into background");
 		daemon(0,0);
+      restart = true;
 	}
 	else
 	{
 		g_debug("Running in foreground");
+      restart = false;
 	}
 
 	remove_obsolete_script();
 
-	init_sm();
+	init_sm (restart);
 
 	trayicon = g_object_new (SYNCE_TRAYICON_TYPE, "title", "SynCE", NULL);
 
$ synce-trayicon -f
** (synce-trayicon:18767): DEBUG: Running in foreground
** (synce-trayicon:18767): DEBUG: module_load_all: loading module 
/usr/lib/synce-trayicon/modules/gnomevfs-trayicon-module.so
** (synce-trayicon:18767): DEBUG: module_load_all: loading module 
/usr/lib/synce-trayicon/modules/test-mod.so
** (synce-trayicon:18767): DEBUG: g_module_check_init: running from trayicon 
test module for /usr/lib/synce-trayicon/modules/test-mod.so



** (synce-trayicon:18767): DEBUG: odccm_device_connected_cb: Received connect 
from odccm: /org/synce/odccm/Device/_2C343682_C645_9887_675F_401F60866DD0_

** (synce-trayicon:18767): CRITICAL **: get_device_name_via_rapi: 
CeRegOpenKeyEx failed getting device name




** (synce-trayicon:18767): CRITICAL **: dbus_g_proxy_get_path: assertion 
`DBUS_IS_G_PROXY (proxy)' failed

(synce-trayicon:18767): GLib-CRITICAL **: g_ascii_strcasecmp: assertion `s2 != 
NULL' failed

** (synce-trayicon:18767): WARNING **: wm_device_manager_remove_by_name_impl: 
Device IO2 not removed
** (synce-trayicon:18767): DEBUG: device_disconnected_cb: Ignoring 
disconnection message for "IO2", not connected

(synce-trayicon:18767): GLib-GObject-CRITICAL **: g_object_unref: assertion 
`G_IS_OBJECT (object)' failed
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
SynCE-Devel mailing list
SynCE-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synce-devel

Reply via email to