Gtk 0.7006: Memory leak in Gdk::Pixmap?



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.






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