فهرست منبع

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 سال پیش
والد
کامیت
f7e4ea8fa4
1فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  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