Re: Threaded Gtk2->main causing seg fault



On Wednesday, April 21, 2004, at 06:02 PM, Kevin Leung wrote:

The warnings are as followed:

in callbackUnbalanced string table refcount: (2) for "::ISA::CACHE::" during global destruction. Unbalanced string table refcount: (1) for "signal_connect" during global destruction. Unbalanced string table refcount: (1) for "add" during global destruction. Unbalanced string table refcount: (2) for "DESTROY" during global destruction. Unbalanced string table refcount: (1) for "show_all" during global destruction.

These are not gtk2-perl warnings -- they are perl's warnings, from perl_destruct() in perl.c, and.

I do find it curious that it's warning about subroutine names.

The segfault occurs in g_type_check_instance_is_a(), called from XS_Glib__Object_DESTROY(), which is the actual C function that gets called by Glib::Object::DESTROY(). This is not so surprising, because of the fact that both threads are trying to clean up the object, but there's only one actual GObject attached via magic to the perl scalar. From the looks of it, the child thread is cleaning it up out from under the main thread.

When i added a "\n" to the line "print 'in callback';", the program ceased segfaulting, which of course, looks like a Heisenbug.



package main;
use Gtk2 '-init';
use threads;
use threads::shared;

my $base = Base->new ();
share ($base);

erm, that's not really supported.  quoting threads::shared:

   BUGS
"bless" is not supported on shared references. In the current version, "bless" will only bless the thread local reference and the blessing will not propagate to the other threads. This is expected to be imple-
       mented in a future version of Perl.

so, i admit i'm actually surprised that it works at all.


i know this doesn't answer your questions. i'll look at it again, later; i'm out of time for today.

--
"Ghostbusters" is the best movie of this decade.
  -- Neal, circa 1996, referring to a movie released in 1984.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]