Re: Problem with global destruction



I wrote:
class is created and used. I've defined two new signal types for the object.

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 Gtk2::ScrolledWindow):

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

the problem appears. The $self->{image} is created in the INIT_INSTANCE function and it is never destroyed, in sub render it is set from a new pixmap:

$self->{image}->set_from_pixbuf(undef);
$self->{image}->set_from_pixmap($self->{pixmap},undef);

The size_allocate is like this:

sub size_allocate {
   my($image,$allocation,$self) = @_;
   my @old_v = (0,0);
   @old_v = @{$self->{viewport_size}} if $self->{viewport_size};
   my @v = $allocation->values;
   @{$self->{viewport_size}} = @v[2..3];
   $self->render() if $v[2] != $old_v[0] or $v[3] != $old_v[1];
   return 0;
}

Ari

--
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 tkk.fi URL: http://www.tkk.fi/~jolma




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