Skip to content

Commit

Permalink
stop global-destruction errors in driver DESTROY
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Apr 20, 2024
1 parent 9df26e7 commit 99f32ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 3 additions & 1 deletion lib/PDL/Graphics/Simple/PGPLOT.pm
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ sub plot {
sub DESTROY {
my $me = shift;

$me->{obj}->release;
eval { # in case of global destruction
$me->{obj}->release;
};

if (defined $me->{type} and $me->{type} =~ m/^f/i) {
eval { $me->{obj}->close; };
Expand Down
12 changes: 5 additions & 7 deletions lib/PDL/Graphics/Simple/Prima.pm
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ sub new {

sub DESTROY {
my $me = shift;

print "DESTROYING $me\n";

if($me->{type} =~ m/f/i) {
##############################
# File-saving code...
Expand Down Expand Up @@ -242,8 +239,10 @@ sub DESTROY {
}
}

$me->{obj}->hide;
$me->{obj}->destroy;
eval { # in case of global destruction
$me->{obj}->hide;
$me->{obj}->destroy;
};
}

##############################
Expand All @@ -263,7 +262,7 @@ sub PDL::Graphics::Simple::Prima::Sepia_Palette::apply {
$min = $data->min unless(defined($min));
$max = $data->max unless(defined($max));

my $g = ($min==$max)?$ data->zeroes : (($data->double - $min)/($max-$min))->clip(0,1);
my $g = ($min==$max)? $data->zeroes : (($data->double - $min)/($max-$min))->clip(0,1);
my $r = $g->sqrt;
my $b = $g*$g;

Expand Down Expand Up @@ -478,7 +477,6 @@ sub plot {
$yscale = ($pmax-$pmin)/($dmax-$dmin);

my $ratio = $yscale / $xscale;
print "ratio=$ratio\n";
if($ratio > 1) {
# More Y pixels per datavalue than X pixels. Hence we expand the Y range.
my $ycen = ($dmax+$dmin)/2;
Expand Down

0 comments on commit 99f32ba

Please sign in to comment.