After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 151244 - GnomeVFSVolumeMonitor crashes if unref'ed after gnome_vfs_shutdown
GnomeVFSVolumeMonitor crashes if unref'ed after gnome_vfs_shutdown
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: Other
2.6.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
Depends on:
Blocks:
 
 
Reported: 2004-08-27 20:26 UTC by Torsten Schoenfeld
Modified: 2005-02-01 15:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Program demonstrating the problem (301 bytes, text/plain)
2004-08-27 20:27 UTC, Torsten Schoenfeld
  Details
Backtrace (1.70 KB, text/plain)
2004-08-27 20:27 UTC, Torsten Schoenfeld
  Details
Patch that allows monitors to live after shutdown (4.39 KB, patch)
2004-08-31 08:25 UTC, Alexander Larsson
none Details | Review

Description Torsten Schoenfeld 2004-08-27 20:26:27 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
Comment 1 Torsten Schoenfeld 2004-08-27 20:27:01 UTC
Created attachment 31031 [details]
Program demonstrating the problem
Comment 2 Torsten Schoenfeld 2004-08-27 20:27:18 UTC
Created attachment 31032 [details]
Backtrace
Comment 3 Christophe Fergeau 2004-08-31 07:25:41 UTC
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 ***
Comment 4 Christophe Fergeau 2004-08-31 07:30:21 UTC
Hmm, I was too hasty in closing that bug, I thought something was missing in the
code while it wasn't :)
Comment 5 Alexander Larsson 2004-08-31 07:49:13 UTC
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.
Comment 6 Alexander Larsson 2004-08-31 08:25:38 UTC
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.
Comment 7 Torsten Schoenfeld 2004-08-31 13:24:30 UTC
Just for the record: Yes, that patch seems to fix the problem.
Comment 8 Christian Kellner 2005-02-01 15:23:38 UTC
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.