Commit 3643e074 authored by Christian Fibich's avatar Christian Fibich Committed by Stefan Tauner
Browse files

Corrected Tk cleanup on exit, splash screen takes focus during netlist loading

parent c8a811f4
......@@ -22,7 +22,7 @@ sub Populate {
my $logger = get_logger("");
my ($self, $args) = @_;
$self->{'delete_mw'} = delete $args->{'-delete_mw'};
$self->{'mw'} = delete $args->{'-mw'};
$self->{'mw'} = delete $args->{'-mw'};
my $image = delete $args->{'-image'};
my $text = delete $args->{'-text'};
my $wraplength = delete $args->{'-wraplength'};
......@@ -38,7 +38,6 @@ sub Show {
my ($self) = @_;
if (defined $self->{'mw'} && defined $self->{'delete_mw'}) {
$self->{'mw'}->protocol('WM_DELETE_WINDOW' => sub {
$self->{'mw'}->destroy(); # according to Mastering O'Reilly
return 1;
});
}
......
......@@ -80,6 +80,7 @@ my $ql = Thread::Queue->new(); # Queue for communicating log messages to the
my $worker_tid;
my $downloader;
my $unsaved_changes = 0;
my $delete_main = 1;
my $current_dir = ".";
......@@ -349,13 +350,8 @@ sub main {
bailout:
# End the queue(s) to signal other threads to stop
# There is a bug in 804.031 (and below?) that sometimes provokes
# segfaults with this procedure, cf. https://rt.cpan.org/Public/Bug/Display.html?id=89621
$qw->end();
$qr->end();
$ql->end();
#$worker_tid->join();
$self->_cleanup();
$logger->trace("=== Stopping execution ===");
return $ret;
}
......@@ -832,6 +828,15 @@ sub _onexit {
return;
finish:
$delete_main = 0;
$self->{'mw'}->destroy();
return;
}
sub _cleanup {
my $self = shift;
$self->{'mw'}->destroy() if $delete_main; # according to Mastering O'Reilly
# End the queue(s) to signal other threads to stop
# There is a bug in 804.031 (and below?) that sometimes provokes
# segfaults with this procedure, cf. https://rt.cpan.org/Public/Bug/Display.html?id=89621
......@@ -839,8 +844,6 @@ finish:
$qr->end();
$ql->end();
#$worker_tid->join();
$logger->trace("=== Stopping execution ===");
exit 0;
}
my $log_conf = File::Spec->catfile($FindBin::Bin, 'logger.conf');
......
......@@ -81,7 +81,7 @@ my $abouttxt = <<'END_ABOUT';
END_ABOUT
my $unsaved_changes = 0;
my $delete_main = 1;
my $error_image;
my $alert_image;
my $save_image;
......@@ -221,7 +221,7 @@ sub main {
-title => 'Open FIJI Settings failed!',
-buttons => ["OK"]);
$d->Show();
return;
goto bailout;
}
if (!defined($self->{'FIJISettingsViewer'}->settings($tmp_settings))) {
my $msg = "Could not update GUI correctly with new settings.";
......@@ -234,7 +234,7 @@ sub main {
-title => 'Open FIJI Settings failed!',
-buttons => ["OK"]);
$d->Show();
return;
goto bailout;
}
$self->{'settings'} = $tmp_settings;
} else {
......@@ -247,6 +247,9 @@ sub main {
MainLoop;
bailout:
$self->_cleanup();
$logger->trace("=== Stopping execution ===");
return 0;
}
......@@ -545,6 +548,7 @@ sub _open_netlist_file {
$SIG{ALRM} = sub { if(defined $do_splash) {
if ($do_splash eq 'start') {
$splash->place(-bordermode=>'inside',-anchor=>'center',-relx => 0.5, -rely => 0.5,-relwidth=>1,-relheight=>1);
$splash->focus;
$splash->parent->update;
}
}
......@@ -764,11 +768,22 @@ sub _onexit {
$logger->info("Save: " . (defined $response ? $response : "undef"));
if (!defined $response || $response ne "Cancel") {
exit;
goto finish;
}
} else {
exit;
goto finish;
}
return;
finish:
$delete_main = 0;
$self->{'mw'}->destroy();
return;
}
sub _cleanup {
my $self = shift;
$self->{'mw'}->destroy() if $delete_main; # according to Mastering O'Reilly
}
my $log_conf = File::Spec->catfile($FindBin::Bin, 'logger.conf');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment