File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -864,9 +864,7 @@ keeptwiddling3d();
864864
865865*close3d = *close3d = \&PDL::close3d;
866866sub PDL ::close3d {
867- return if !ref $PDL::Graphics::TriD::current_window ;
868- return if !$PDL::Graphics::TriD::current_window -> can(' close' );
869- $PDL::Graphics::TriD::current_window -> close ;
867+ $PDL::Graphics::TriD::current_window = undef ;
870868}
871869
872870sub graph_object {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use strict;
44use warnings;
55use OpenGL::GLFW qw( :all ) ;
66use OpenGL::Modern::Helpers qw( glGetVersion_p) ;
7+ use Scalar::Util qw( weaken) ;
78
89our @ISA = qw( PDL::Graphics::TriD::GL) ;
910my ($window_seq , @fakeXEvents , %winObjects ) = 0;
@@ -39,7 +40,7 @@ sub new {
3940 if ($PDL::Graphics::TriD::verbose ) {
4041 print " GLFW driver: Got TriD::GL object(GLFW window ID#$self ->{window_seq} " . $self -> {glfwwindow } . " )\n " ;
4142 }
42- $self -> {winobjects }{$self -> {glfwwindow }} = $window_obj ; # circular ref
43+ weaken( $self -> {winobjects }{$self -> {glfwwindow }} = $window_obj );
4344 $self ;
4445}
4546
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use warnings;
55use OpenGL::GLUT qw( :all ) ;
66use OpenGL::Config;
77use OpenGL::Modern::Helpers qw( glGetVersion_p) ;
8+ use Scalar::Util qw( weaken) ;
89
910our @ISA = qw( PDL::Graphics::TriD::GL) ;
1011my (@fakeXEvents , @winObjects );
@@ -56,7 +57,7 @@ sub _init_glut_window {
5657 if ($PDL::Graphics::TriD::verbose ) {
5758 print " GLUT driver: Got TriD::GL object(GLUT window ID# " . $self -> {glutwindow } . " )\n " ;
5859 }
59- $self -> {winobjects }-> [$self -> {glutwindow }] = $window_obj ; # circular ref
60+ weaken( $self -> {winobjects }-> [$self -> {glutwindow }] = $window_obj );
6061}
6162
6263sub DESTROY {
You can’t perform that action at this time.
0 commit comments