Prechádzať zdrojové kódy

Fix #192: DEMOLISH slightly earlier, before losing references

Sometimes, the $self->commands reference goes away during DEMOLISH and
we end up throwing an unsightly, unhelpful error to the user.
Daniel Gempesaw 10 rokov pred
rodič
commit
f7e4ea8fa4
1 zmenil súbory, kde vykonal 4 pridanie a 2 odobranie
  1. 4 2
      lib/Selenium/Remote/Driver.pm

+ 4 - 2
lib/Selenium/Remote/Driver.pm

@@ -486,11 +486,13 @@ sub new_from_caps {
     return $self->new(%args);
 }
 
-sub DEMOLISH {
+before 'DEMOLISH' => sub {
     my ($self) = @_;
     return if $$ != $self->pid;
     $self->quit() if ( $self->auto_close && defined $self->session_id );
-}
+};
+
+sub DEMOLISH {}
 
 # This is an internal method used the Driver & is not supposed to be used by
 # end user. This method is used by Driver to set up all the parameters