ID 443793 - [PUBLIC] Nuke crashes when creating a QApplication() with Python

Follow

Problem summary:

Nuke crashes when creating a QApplication() with Python

 

Customer reported version:

Nuke 13.2v6

 

Customer reported platform:

CentOS 7

 

Steps to reproduce:

1) Launch Nuke and open the Script Editor window.

2) Run the following lines of code:

from PySide2 import QtWidgetsapp = QtWidgets.QApplication(sys.argv)

3) Observe Nuke's performance.

 

Expected behavior:

Nuke should raise a RuntimeError similar to the one produced by the same code in Nuke 11.3v6: A QApplication instance already exists.

 

Actual behavior:

Attempting to create a QApplication() will cause Nuke to crash, regardless of what argument is passed. For example, the following code also causes Nuke to crash:

from PySide2 import QtWidgetssome_list = ["apples", "oranges", "pears"] app = QtWidgets.QApplication(some_list)

 

In the Nuke 12 series, the code in step 2 does not cause a crash to occur. However, Nuke 12 appears to crash if the QApplication() is then accessed in some other way, like with print() or type():

from PySide2 import QtWidgetsapp = QtWidgets.QApplication(sys.argv)print(app)

 

Workaround:

Using QtWidgets.QApplication.instance() instead of QtWidgets.QApplication() seems to prevent the crash.

 

Reproduced by Support in:

Nuke 14.0v6 - Windows 10, CentOS 7

Nuke 14.0v1 - Windows 10

Nuke 13.0v1 - Windows 10, CentOS 7 - Regression

 

Unable to reproduce bug in:

Nuke 12.2v11 - Windows 10, CentOS 7

 

Earliest version tested:

Nuke 12.2v11 - This issue doesn't appear in this version and has regressed

    We're sorry to hear that

    Please tell us why