Преглед изворни кода

Give up if we're in gd in CanStartBinary

There's no guarantee that we can do anything if we're global
destruction. The only reasonable thing to do is to bail out so as not to
throw any warnings or errors; to guarantee a cleanup, the user _must_
make sure to dispose of their objects appropriately.

Specifically in regards to CanStartBinary, the `system` process that we
created earlier to run the binary does seem to kill itself before global
destruction, so that's nice.
Daniel Gempesaw пре 10 година
родитељ
комит
2d32e047ba
1 измењених фајлова са 5 додато и 4 уклоњено
  1. 5 4
      lib/Selenium/CanStartBinary.pm

+ 5 - 4
lib/Selenium/CanStartBinary.pm

@@ -306,10 +306,11 @@ sub shutdown_windows_binary {
     }
 }
 
-# We want to do things before the DEMOLISH phase, as during DEMOLISH
-# we apparently have no guarantee that anything is still around
-before DEMOLISH => sub {
-    my ($self) = @_;
+sub DEMOLISH {
+    my ($self, $in_gd) = @_;
+
+    # if we're in global destruction, all bets are off.
+    return if $in_gd;
     $self->shutdown_binary;
 };