Skip to content
Snippets Groups Projects

Fix PySide6.8 signal-slot threading problem

Merged Kien Le requested to merge bug-#293-pyside6.8_threading_causes_crash into develop
2 unresolved threads
1 file
+ 4
1
Compare changes
  • Side-by-side
  • Inline
@@ -9,7 +9,10 @@ from PySide6.QtCore import Qt
from PySide6 import QtCore, QtWidgets
from sohstationviewer.conf import constants
from sohstationviewer.controller.util import display_tracking_info
from sohstationviewer.controller.util import (
display_tracking_info,
DisplayTrackingInfoWrapper,
)
from sohstationviewer.model.general_data.general_data import (
GeneralData, ThreadStopped, ProcessingDataError)
from sohstationviewer.model.reftek_data.reftek_reader.log_file_reader import \
@@ -64,7 +67,11 @@ class DataLoaderWorker(QtCore.QObject):
# the read. Since self.run runs in a background thread, we need to use
# signal-slot mechanism to ensure that display_tracking_info runs in
# the main thread.
self.notification.connect(display_tracking_info)
self.tracking_info_display = DisplayTrackingInfoWrapper()
    • Maintainer

      Do we need self. here?

      Edited by Lan Dam
      • Author Developer

        Probably not? I added it just in case the reference to the method is garbage collected. I have encountered this kind of issue before where an object gets deleted if they are not saved as an instance attribute.

      • Please register or sign in to reply
Please register or sign in to reply
self.notification.connect(
self.tracking_info_display.display_tracking_info,
type=Qt.ConnectionType.QueuedConnection
)
self.end_msg = None
# to change display tracking info to error when failed
self.process_failed: bool = False
Loading