GNOME Bugzilla – Bug 151244
GnomeVFSVolumeMonitor crashes if unref'ed after gnome_vfs_shutdown
Last modified: 2005-02-01 15:23:38 UTC
Aloha, if you take a ref on a monitor and release it after gnome-vfs has been shut down, you wake up in an error trap caused by bonobo_poa_get_threaded returning CORBA_OBJECT_NIL, which is most probably due to gnome-vfs being uninitialized. Attached is a test program to reproduce the problem, and a backtrace. I do realize this is not really common usage, but unfortunately that's exactly what the Perl bindings do, and there really is no other way to do it. We have to take a reference until the variable that refers to the monitor is alive -- otherwise we risk pointing to an invalid object. And if the variable goes out of scope after gnome_vfs_shutdown has been called, the above problem occurs. Also, this approach seems to work for pretty much all the other types in gnome-vfs (GnomeVFSURI, GnomeVFSDrive, etc.). Bye, -Torsten
Created attachment 31031 [details] Program demonstrating the problem
Created attachment 31032 [details] Backtrace
This is related to bug #151463. If the_volume_monitor is set to NULL in gnome_vfs_volume_monitor_shutdown, I think your problem will go away. *** This bug has been marked as a duplicate of 151463 ***
Hmm, I was too hasty in closing that bug, I thought something was missing in the code while it wasn't :)
This is complicated. Really, GnomeVFSVolumeMonitor isn't meant to be refcounted (although for some reason there are refcount methods for it). Its meant to be a singleton that lives while gnome-vfs does. In order to properly refcount volume manager objects on the server side we need to unregister the client object with the vfs daemon, and that cannot be done after gnome-vfs has been shut down. So, finalization of the monitor after vfs shutdown isn't possible. I guess it could be possible to shutdown the volume manager without finalizing it though... I'll make up a patch that tries that.
Created attachment 31121 [details] [review] Patch that allows monitors to live after shutdown What about this patch. It allows monitors to live past shutdown, but they won't try to do any corba calls.
Just for the record: Yes, that patch seems to fix the problem.
Patch got applied with by commit: 2004-09-14 Alexander Larsson <alexl@redhat.com> * libgnomevfs/gnome-vfs-volume-monitor-client.c: * libgnomevfs/gnome-vfs-volume-monitor-client.h: * libgnomevfs/gnome-vfs-volume-monitor.c: Allow unreffing the volume monitor after shutdown.