Re: Problem with global destruction

hmm, I updated to the latest (2.12.11) libgobject-2.0.0.dll from (I was using 2.10.7(?) which is available from

and the problem disappeared...


muppet kirjoitti:
Ari Jolma wrote:
I tried commenting out every line of code which has something to do with
signals and it turns out that if I connect the size_allocate signal to a
function (this is in sub INIT_INSTANCE of the subclass of

$self->{image}->signal_connect(size_allocate => \&size_allocate, $self);

the problem appears.

At first blush, it sounds like you have created a reference leak.  (This is
far from definitive, but that's what it sounds like.)

Try overriding the destroy signal (NOT the DESTROY method, but the "destroy"
signal!!) on your ScrolledWindow subclass, and in there, disconnect the signal
and destroy the child.

Couldn't do that, the signal seems to connect (it returns an integer)
but does not get called (I tried signals "destroy" and "destroy_event").
However, I can call the do_destroy (below) from the close subroutine of
the main window. But that does seem to help :(


   # keep the handler id so we can disconnect it later
   $self->{image_allocate_signal} =
        $self->{image}->signal_connect(size_allocate => \&size_allocate, $self);

 # do_destroy
   # disconnect the handler added in INIT_INSTANCE to break the ref cycle
   $self->{image}->signal_handler_disconnect ($self->{image_allocate_signal});
   # chain up, so that the rest of the destruction happens properly
   $self->signal_chain_from_overridden (@_);
   # release our own reference (may not be strictly necessary)
   delete $self->{image};

Prof. Ari Jolma
Geoinformaatio- ja paikannustekniikka
Geoinformation and positioning technology
Teknillinen Korkeakoulu / Helsinki University of Technology
POBox 1200, 02015 TKK, Finland
Email: ari.jolma at URL:

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