Re: Gtk 0.7006: Memory leak in Gdk::Pixmap?



Hi!

I reported about this a while ago, but I didn't find a real solution
to it. In the end I made a very ugly work around by adding an 
additional  gdk_pixbuf_unref(self);  in GdkPixbuf/xs/GdkPixbuf.c
and then manually doign $pixbuf->DESTROY() to have this 
function called. 

I hope I'll have time to look in to it, but if someone with more
experience and time could do it, that would be great.

Dov

On Fri, May 18, 2001 at 12:02:48PM +0400, Pavel Rousnak wrote:
Hi!

It seems Gtk::Gdk::Pixmap objects do not destroy when they go out of scope.
Is it a well-known problem or just a bug? 
The following test creates some pixmaps each time button is pressed.
Running the test you can see that the size
of X-server grows each time when you press the button.

---------------------------------------------
#!/usr/bin/perl -w

use Gtk 0.7006;
use strict;

init Gtk;

$| = 1;
my $widget = new Gtk::Button("Create Pixmap");
$widget->signal_connect('clicked',  \&make_pixmap_cb);
my $toplev = new Gtk::Window('toplevel');
$toplev->set_default_size(400, 200);
$toplev->add($widget);
$toplev->show_all();
$toplev->signal_connect('delete_event',  sub { Gtk->main_quit(); 0; });

main Gtk;
0;

sub make_pixmap_cb {
  my $widget = shift;
  print "make_pixmap...\n";
  my ($w, $h) = (500, 500);
  my $window = $widget->window();
  for( my $i = 0; $i < 20; ++$i ) {
    my $pm = new Gtk::Gdk::Pixmap($window, $w, $h);
    $pm->draw_rectangle($widget->get_style()->white_gc(), 1, 0, 0, $w, $h);
  }                                                        
  1;
}

-- 
Best regards
Pavel.



_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list




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