From eec1d999bc8cdb4668531d5384503b4e97889b99 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Wed, 21 Jan 2009 15:03:03 +0000 Subject: Avoid a race if w_scan quits too fast --- perl-install/standalone/drakdvb | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'perl-install/standalone') diff --git a/perl-install/standalone/drakdvb b/perl-install/standalone/drakdvb index addc52aab..bfb3c83df 100644 --- a/perl-install/standalone/drakdvb +++ b/perl-install/standalone/drakdvb @@ -37,6 +37,7 @@ my $config_file = "$ENV{HOME}/.mplayer/channels.conf"; my $channel_list = Gtk2::SimpleList->new(N("Channel")=> "text", "id" => "hidden"); my %buttons; my $pid; +my $_w = ugtk2->new(N("Please wait"), grab => 1); sub get_selected_channel() { my ($index) = $channel_list->get_selected_indices; @@ -57,20 +58,20 @@ sub detect_channels { gtkflush(); - if ($pid = fork()) { - $SIG{CHLD} = sub { - $SIG{CHLD} = 'IGNORE'; - waitpid($pid, 0); - if($?){ - load_channels(); - } else { - $in->ask_warn(N("Error"), N("Could not get the list of available channels")); - }; - gtkset_mousecursor_normal($w->{window}->window); - $buttons{detect}->set_sensitive(1); - $channel_list->set_sensitive(1); + $SIG{CHLD} = sub { + $SIG{CHLD} = 'IGNORE'; + $_w->{window}->hide; + waitpid($pid, 0); + if($?){ + load_channels(); + } else { + $in->ask_warn(N("Error"), N("Could not get the list of available channels")); }; - my $_w = ugtk2->new(N("Please wait"), grab => 1); + gtkset_mousecursor_normal($w->{window}->window); + $buttons{detect}->set_sensitive(1); + $channel_list->set_sensitive(1); + }; + if ($pid = fork()) { gtkadd($_w->{window}, gtkpack($_w->create_box_with_title(N("Detecting DVB channels, this will take a few minutes")), my $w = gtknew('Button', text => N("Cancel"), clicked => \&exitapp), @@ -78,7 +79,9 @@ sub detect_channels { ); $_w->main; } else { + $SIG{CHLD} = 'DEFAULT'; system("w_scan -X > $config_file"); + sleep(1); POSIX::_exit($?); } } -- cgit v1.2.1