diegogarciahuerta / tk-blender

:milk_glass: Shotgun Toolkit Engine for Blender: https://www.blender.org/
Other
44 stars 33 forks source link

Blender 3.4/3.6 - QT Menus not being destroyed consistently and SEGFAULTing #19

Open jonahjnewton opened 2 months ago

jonahjnewton commented 2 months ago

Describe the bug QT windows opened through the Shotgun menu do not always get destroyed properly when they are closed, and thus cause Segmentation Faults often. I believe this is either due to the QT event loop not being handled properly, or the threads created by tk-framework-shotgunutils not being resolved before the window is destroyed with destroyLater in tk-core.

This happens very consistently when trying to create a New File through tk-multi-workfiles2, and also occurs when opening and closing the tk-multi-workfiles2 or tk-multi-about windows 2-3 times.

To Reproduce Steps to reproduce the behavior:

  1. Load Blender 3.4+ with tk-blender
  2. Open tk-multi-workfiles2 File Open menu.
  3. Close tk-multi-workfiles2 File Open menu. Repeat 2-3 times.
  4. Blender will crash with a Seg Fault.

Desktop (please complete the following information):

Additional context To prevent the QtWindowEventLoop operator from returning FINISHED immediately after opening Blender, I commented out the following lines in Shotgun_menu.py, causing the TIMER event to run continuously.

if self._app and not self.anyQtWindowsAreOpen():
        self.cancel(context)
        return {"FINISHED"}

The error occurs regardless of whether these lines are commented out or not.