@@ -294,7 +294,12 @@ def start_marker_input_monitor_thread(self, callback_tag):
294
294
295
295
def stop_marker_input_monitor_thread (self ):
296
296
if self .fetch_marker_input_thread is not None and self .fetch_marker_input_thread .isRunning ():
297
- self .fetch_marker_input_thread .running_flag = False
297
+ self .fetch_marker_input_thread .stop ()
298
+ # NOTE:
299
+ # We need call QThread.wait() function before reset QThread object to None.
300
+ # Set to None will trigger Python GC release QThread object, if QThread is still running,
301
+ # Segment falut "QThread: Destroyed while thread is still running" will throw, it will crash EAF.
302
+ self .fetch_marker_input_thread .wait ()
298
303
self .fetch_marker_input_thread = None
299
304
300
305
def start_search_input_monitor_thread (self , callback_tag ):
@@ -306,6 +311,11 @@ def start_search_input_monitor_thread(self, callback_tag):
306
311
def stop_search_input_monitor_thread (self ):
307
312
if self .fetch_search_input_thread is not None and self .fetch_search_input_thread .isRunning ():
308
313
self .fetch_search_input_thread .stop ()
314
+ # NOTE:
315
+ # We need call QThread.wait() function before reset QThread object to None.
316
+ # Set to None will trigger Python GC release QThread object, if QThread is still running,
317
+ # Segment falut "QThread: Destroyed while thread is still running" will throw, it will crash EAF.
318
+ self .fetch_search_input_thread .wait ()
309
319
self .fetch_search_input_thread = None
310
320
311
321
@abstract
@@ -491,6 +501,9 @@ def run(self):
491
501
492
502
time .sleep (0.1 )
493
503
504
+ def stop (self ):
505
+ self .running_flag = False
506
+
494
507
class FetchSearchInputThread (QThread ):
495
508
496
509
search_changed = pyqtSignal (str , str )
0 commit comments