Commit 090c2671 authored by Christian Fibich's avatar Christian Fibich Committed by Stefan Tauner
Browse files

Fixed some bugs in Net Selection Dialog

* Segfault when deselecting all nets
* When a net entry was empty (" "), the user first had to de-select this net
parent db30748d
......@@ -130,7 +130,9 @@ sub _populate_widget {
if ($self->{'select_multiple'}) {
$self->{'unselect_all_button'} = $self->Button(-text=>'<<',-state=>'disabled', -command=> sub {
@{$self->{'selected_nets_listref'}} = ();
# empty out the listref
undef(@{$self->{'selected_nets_listref'}});
$self->{'selected_listbox'}->configure(-listvariable=>$self->{'selected_nets_listref'});
$self->{'unselect_all_button'}->configure(-state=>'disabled');
$self->{'unselect_button'}->configure(-state=>'disabled');
$self->{'selected'} = 0;
......@@ -187,6 +189,7 @@ sub _populate_widget {
my $selected_index = $self->{'selected_listbox'}->index('active');
# can't use grep (segfault)
my @new_selected_nets = ();
return if ($selected_index >= @{$self->{'selected_nets_listref'}});
for (my $i = 0; $i < @{$self->{'selected_nets_listref'}}; $i++) {
my $netname = @{$self->{'selected_nets_listref'}}[$i];
push (@new_selected_nets, $netname) unless ($netname eq @{$self->{'selected_nets_listref'}}[$selected_index]);
......@@ -196,8 +199,11 @@ sub _populate_widget {
if ($self->{'select_multiple'}) {
$self->{'select_button'}->configure(-state=>'active') if @{$self->{'found_netnames'}} > 0;
$self->{'unselect_button'}->configure(-state=>'disabled') if (@{$self->{'selected_nets_listref'}} == 0);
$self->{'selected'} = 0 if (@{$self->{'selected_nets_listref'}} == 0);
if (@{$self->{'selected_nets_listref'}} == 0) {
$self->{'unselect_all_button'}->configure(-state=>'disabled');
$self->{'unselect_button'}->configure(-state=>'disabled');
$self->{'selected'} = 0;
}
} else {
$self->{'select_button'}->configure(-state=>'active') if @{$self->{'found_netnames'}} > 0;
$self->{'unselect_button'}->configure(-state=>'disabled');
......
......@@ -572,7 +572,11 @@ sub _populate_widget {
$select_button->configure(
-command => sub {
my $netname = [$self->{'settings'}->{'design'}->{$k}];
my $netname = [];
my $old_value = $self->{'settings'}->{'design'}->{$k};
# only display old value if not empty
push @{$netname}, $old_value if (defined $old_value && !($old_value =~ /^\s*$/));
my $rv = $self->_select_net_dialog($netname,"Select Net for $k");
if (defined $rv) {
$logger->warn($rv);
......
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