File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1088,6 +1088,11 @@ Stub::GetOrCreateInstance()
10881088void
10891089Stub::DestroyInstance ()
10901090{
1091+ if (!stub_instance) {
1092+ return ;
1093+ }
1094+
1095+ stub_instance->DestroyPythonObjects ();
10911096 stub_instance.reset ();
10921097}
10931098
@@ -2197,7 +2202,6 @@ main(int argc, char** argv)
21972202 non_graceful_exit = true ;
21982203
21992204 // Destroy stub and exit.
2200- stub->DestroyPythonObjects ();
22012205 logger.reset ();
22022206 Stub::DestroyInstance ();
22032207 exit (1 );
@@ -2231,7 +2235,6 @@ main(int argc, char** argv)
22312235 // objects. If the scoped_interpreter is destroyed before the stub object,
22322236 // this process will no longer hold the GIL lock and destruction of the stub
22332237 // will result in segfault.
2234- stub->DestroyPythonObjects ();
22352238 logger.reset ();
22362239 Stub::DestroyInstance ();
22372240
Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ class Stub {
269269
270270 // / Cleans up Python objects and must be called before the destructor.
271271 // / This prevents problems that occur when Python object destructors
272- // / call Stub::GetOrCreate .
272+ // / call Stub::GetOrCreateInstance .
273273 void DestroyPythonObjects ();
274274
275275 // / Calls the user's is_ready() Python method and returns its response
You can’t perform that action at this time.
0 commit comments