ID 322624 - Nuke crashes when loading QGuiApplication.palette() in terminal mode (-t)

Follow

Problem summary
Nuke crashes when loading QGuiApplication.palette() in terminal mode (-t).
If you have a GUI Nuke session active or load in a non-gui based QPalette, then the issue does not seem to occur.

Customer reported version
nuke.n/a

Customer reported platform

Steps to reproduce

1) Open Nuke in terminal mode (-t)

2) Run the below two lines of code, Nuke will crash:

from PySide2.QtGui import QGuiApplication 
QGuiApplication.palette()

Workaround
You can launch Nuke in terminal mode with a QApplication available, then Nuke does not crash. This can be done by using --tg when launching Nuke.

You can also substitute QGuiApplication.palette() with QtGui.QPalette, using the code below:
from PySide2.QtCore import QCoreApplication
from PySide2.QtWidgets import QApplication
from PySide2.QtGui import QPalette

palette = None
if isinstance(QCoreApplication.instance(), QApplication):
    palette = QGuiApplication.palette()
else:
    palette = QPalette()
 
Reproduced by support
This bug has been reproduced in:
Nuke 11.0v3 - Windows 10, CentOS 6.8, OSX 10.13
Nuke 11.0v1 - Windows 10, CentOS 6.8, OSX 10.13

Earliest version tested
Nuke 11.0v1 - This feature did not exist before this version
Expected behaviour
For Nuke to return the QGuiApplication.palette()

Actual behaviour
Nuke crashed

    We're sorry to hear that

    Please tell us why