Commit 58939d65 authored by Stefan Tauner's avatar Stefan Tauner
Browse files

fiji_download_gui.pl: try to join threads before exiting also in case of errors

But the obvious solution fails... add a FIXME instead
parent 36359672
...@@ -85,6 +85,7 @@ sub main { ...@@ -85,6 +85,7 @@ sub main {
my $logger = get_logger(""); my $logger = get_logger("");
my $name = $0; my $name = $0;
my @ARGV = @_; my @ARGV = @_;
my $ret = 0;
$name =~ s/\.p[lm]//; $name =~ s/\.p[lm]//;
$logger->debug("=== Starting new execution of $name ==="); $logger->debug("=== Starting new execution of $name ===");
$logger->debug( sprintf( "%d argument(s)%s", scalar(@_), scalar(@_) > 0 ? ": @_" : "" ) ); $logger->debug( sprintf( "%d argument(s)%s", scalar(@_), scalar(@_) > 0 ? ": @_" : "" ) );
...@@ -135,7 +136,8 @@ sub main { ...@@ -135,7 +136,8 @@ sub main {
-title => 'Open FIJI settings failed!', -title => 'Open FIJI settings failed!',
-text => "$msg\n", -text => "$msg\n",
)->Show(); )->Show();
return; $ret = 1;
goto bailout;
} }
$self->{'settings'} = $tmp_settings; $self->{'settings'} = $tmp_settings;
} }
...@@ -145,7 +147,8 @@ sub main { ...@@ -145,7 +147,8 @@ sub main {
} }
if ( !defined ${ $self->{'settings_ini_name'} } ) { if ( !defined ${ $self->{'settings_ini_name'} } ) {
return 1; $ret = 1;
goto bailout;
} }
if ( defined $ARGV[1] ) { if ( defined $ARGV[1] ) {
...@@ -160,7 +163,8 @@ sub main { ...@@ -160,7 +163,8 @@ sub main {
-title => 'Open FIJI Tests failed!', -title => 'Open FIJI Tests failed!',
-text => "$msg\n", -text => "$msg\n",
)->Show(); )->Show();
return; $ret = 1;
goto bailout;
} }
$self->{'tests'} = $tmp_tests; $self->{'tests'} = $tmp_tests;
} else { } else {
...@@ -199,13 +203,14 @@ sub main { ...@@ -199,13 +203,14 @@ sub main {
MainLoop; MainLoop;
bailout: # FIXME: this should join threads... but doing that segfaults O_o
# End the queue so the thread can die # End the queue so the thread can die
$qw->end(); $qw->end();
$worker_tid->join(); $worker_tid->join();
bailout: # FIXME: this should be above the block above to join all threads... but doing that segfaults O_o bailout: # FIXME: this should be above the block above to join all threads... but doing that segfaults O_o
$logger->trace("=== Stopping execution ==="); $logger->trace("=== Stopping execution ===");
return 0; return $ret;
} }
sub _load_settings_prompt { sub _load_settings_prompt {
......
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