Re: volume monitor refcounting code freeze break
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: "gnome-vfs-list gnome org" <gnome-vfs-list gnome org>
- Subject: Re: volume monitor refcounting code freeze break
- Date: Wed, 01 Sep 2004 10:50:04 +0200
On Wed, 2004-09-01 at 08:26, Mark McLoughlin wrote:
> I guess one question is how do you trigger this with the Perl bindings?
> Do you just need to use the volume monitor API and it happens on
> shutdown or do you have to do something more specific?
You have to store a monitor in a variable that goes out of scope after
you call Gnome2::VFS::shutdown. Example:
#!/usr/bin/perl
use strict;
use warnings;
use Gnome2::VFS -init;
my $monitor = Gnome2::VFS -> get_volume_monitor();
Gnome2::VFS -> shutdown();
The monitor object starts out with a ref-count of 1 when it's created.
When fetching the monitor and storing it in $monitor, the bindings ref
it; when $monitor goes out of scope, the bindings unref it.
gnome_vfs_shutdown also unrefs it. If shutdown() is called while
$monitor is still alive, the monitor doesn't get finalized. It only
happens when the bindings release their ref.
The following would not trigger the bug, as the enclosing block causes
$monitor to go out of scope before shutdown() is called:
#!/usr/bin/perl
use strict;
use warnings;
use Gnome2::VFS -init;
{ my $monitor = Gnome2::VFS -> get_volume_monitor(); }
Gnome2::VFS -> shutdown();
The workaround currently in place is to simply prevent the bindings'
unref from happening at all.
I'm actually wondering why other bindings that do automatic memory
management don't trigger this bug.
--
Bye,
-Torsten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]