diff options
author | Pascal Terjan <pterjan@mandriva.org> | 2009-01-21 15:03:03 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mandriva.org> | 2009-01-21 15:03:03 +0000 |
commit | eec1d999bc8cdb4668531d5384503b4e97889b99 (patch) | |
tree | 79b45087747d8121bc35b113f82f28e09733fb39 /perl-install/standalone | |
parent | 899fee5c1610739a985511f66dea1492b35c9a31 (diff) | |
download | drakx-eec1d999bc8cdb4668531d5384503b4e97889b99.tar drakx-eec1d999bc8cdb4668531d5384503b4e97889b99.tar.gz drakx-eec1d999bc8cdb4668531d5384503b4e97889b99.tar.bz2 drakx-eec1d999bc8cdb4668531d5384503b4e97889b99.tar.xz drakx-eec1d999bc8cdb4668531d5384503b4e97889b99.zip |
Avoid a race if w_scan quits too fast
Diffstat (limited to 'perl-install/standalone')
-rw-r--r-- | perl-install/standalone/drakdvb | 29 |
1 files changed, 16 insertions, 13 deletions
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($?); } } |