summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-07-20 10:42:50 +0000
committerOlivier Blin <oblin@mandriva.org>2004-07-20 10:42:50 +0000
commit7d5657c91150f5486007737f5d5fab26d14bbf08 (patch)
tree04ea35f7f7d2bb0245b94270b7e75faf013f4a24 /perl-install/standalone
parent8a61de9fa3682dd0c345cc154326229b50bbd7f7 (diff)
downloaddrakx-backup-do-not-use-7d5657c91150f5486007737f5d5fab26d14bbf08.tar
drakx-backup-do-not-use-7d5657c91150f5486007737f5d5fab26d14bbf08.tar.gz
drakx-backup-do-not-use-7d5657c91150f5486007737f5d5fab26d14bbf08.tar.bz2
drakx-backup-do-not-use-7d5657c91150f5486007737f5d5fab26d14bbf08.tar.xz
drakx-backup-do-not-use-7d5657c91150f5486007737f5d5fab26d14bbf08.zip
do not allocate new Gtk2::Gdk::GC at each redraw (last memory leak
fixed ?)
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/net_monitor11
1 files changed, 6 insertions, 5 deletions
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor
index 089ee9fb6..cfcead0ce 100755
--- a/perl-install/standalone/net_monitor
+++ b/perl-install/standalone/net_monitor
@@ -72,7 +72,7 @@ my $intf = {};
my $c_time = 0;
my $ct_tag;
-my ($pixmap, $darea);
+my ($pixmap, $darea, $gc_lines);
my ($width, $height) = (300, 150);
my $left_border = 50;
@@ -436,6 +436,10 @@ sub update() {
$darea->{$intf}->signal_connect(expose_event => sub {
$darea->{$intf}->window->draw_drawable($darea->{$intf}->style->bg_gc('normal'), $pixmap->{$intf}, 0, 0, 0, 0, $width, $height);
});
+ $gc_lines->{$intf} = Gtk2::Gdk::GC->new($darea->{$intf}->window);
+ $gc_lines->{$intf}->set_foreground($darea->{$intf}->style->white);
+ $gc_lines->{$intf}->set_line_attributes(1, 'on-off-dash', 'not-last', 'round');
+
}
}
foreach (@interfaces) {
@@ -479,6 +483,7 @@ sub in_ifconfig {
sub draw_monitor {
my ($o, $intf) = @_;
defined $darea->{$intf} or return;
+ my $gcl = $gc_lines->{$intf};
my $pixmap = $pixmap->{$intf};
$pixmap->draw_rectangle($darea->{$intf}->style->black_gc, 1, 0, 0, $width, $height);
my $maxr = 0;
@@ -534,10 +539,6 @@ sub draw_monitor {
$step++;
}
- my $gcl = Gtk2::Gdk::GC->new($darea->{$intf}->window);
- $gcl->set_foreground($darea->{$intf}->style->white);
- $gcl->set_line_attributes(1, 'on-off-dash', 'not-last', 'round');
-
my ($pix_maxr, $pix_maxt);
if ($last_a) {
$pix_maxr = $height - scale_received(@{$o->{stack_ra}}[$last_a]);