[Bug] QGIS crashes instantly on macOS (arm64) in v5.0.3 – QDialog opened from background thread during dependency install
Description
This is a follow-up to #47 (Python interpreter mismatch on macOS arm64), which was fixed in v5.0.3.
After updating to v5.0.3, the interpreter fix works — QGIS now finds the correct Python. However, a new crash has been introduced: QGIS crashes immediately (SIGABRT) when Dzetsaka attempts to install the remaining missing packages. The crash occurs because a QDialog is being opened from within a background QgsTask thread, which violates Qt's rule that all GUI operations must happen on the main thread.
In v5.0.2, this code path was never reached (the wrong interpreter was used, so installation silently failed). Now that the interpreter is correctly detected and installation actually proceeds, the threading bug is exposed.
This is a hard crash with no recovery — QGIS terminates instantly.
Environment
- QGIS Version: 3.44.7
- Dzetsaka Version: 5.0.3 (regression introduced in this version)
- OS: macOS 26.3 (Apple Silicon / ARM64, MacBook Pro)
- Python: 3.12
Steps to Reproduce
- Install Dzetsaka plugin in QGIS on macOS (Apple Silicon)
- Open the Dzetsaka panel
- Dzetsaka detects missing packages and attempts to auto-install them
- QGIS crashes instantly
Missing packages that triggered the crash:
lightgbm
optuna
shap
seaborn
Full bundle Dzetsaka attempted to install:
scikit-learn, xgboost, catboost, optuna, shap, seaborn, imbalanced-learn
Expected Behavior
Missing packages are installed silently in the background, or the user is prompted in a thread-safe way (e.g. via a signal/slot mechanism to the main thread).
Actual Behavior
QGIS crashes immediately with EXC_CRASH (SIGABRT).
Crash Analysis
The macOS crash report clearly shows the cause. Thread 18 (a pooled Qt thread running QgsTask) calls QDialog::exec() directly, which is forbidden outside the main thread:
34 _core.so sipQgsTask::run()
...
27 QtWidgets.abi3.so meth_QDialog_exec(...) ← GUI call from background thread
26 libQt5Widgets.5.15.dylib QDialog::exec()
...
11 AppKit -[NSWindow _initContent:styleMask:backing:defer:contentView:]
10 CoreFoundation -[NSException raise] ← macOS throws exception
2 libsystem_c.dylib abort() ← SIGABRT → QGIS terminates
Root cause: The dependency installation routine runs inside a QgsTask and opens a QDialog from that background thread. On macOS (especially Apple Silicon), AppKit enforces strict main-thread-only UI access and throws an NSException, which propagates as a C++ exception and causes abort().
This does not appear to affect Windows or Linux, where the restriction is not enforced at the OS level.
Workaround
Install all required packages manually into QGIS's Python environment before launching QGIS:
/Applications/QGIS.app/Contents/MacOS/bin/python3 -m pip install \
lightgbm optuna shap seaborn \
scikit-learn xgboost catboost \
imbalanced-learn --upgrade
Doesn't work.
[Bug] QGIS crashes instantly on macOS (arm64) in v5.0.3 – QDialog opened from background thread during dependency install
Description
This is a follow-up to #47 (Python interpreter mismatch on macOS arm64), which was fixed in v5.0.3.
After updating to v5.0.3, the interpreter fix works — QGIS now finds the correct Python. However, a new crash has been introduced: QGIS crashes immediately (SIGABRT) when Dzetsaka attempts to install the remaining missing packages. The crash occurs because a
QDialogis being opened from within a backgroundQgsTaskthread, which violates Qt's rule that all GUI operations must happen on the main thread.In v5.0.2, this code path was never reached (the wrong interpreter was used, so installation silently failed). Now that the interpreter is correctly detected and installation actually proceeds, the threading bug is exposed.
This is a hard crash with no recovery — QGIS terminates instantly.
Environment
Steps to Reproduce
Missing packages that triggered the crash:
lightgbmoptunashapseabornFull bundle Dzetsaka attempted to install:
scikit-learn,xgboost,catboost,optuna,shap,seaborn,imbalanced-learnExpected Behavior
Missing packages are installed silently in the background, or the user is prompted in a thread-safe way (e.g. via a signal/slot mechanism to the main thread).
Actual Behavior
QGIS crashes immediately with
EXC_CRASH (SIGABRT).Crash Analysis
The macOS crash report clearly shows the cause. Thread 18 (a pooled Qt thread running
QgsTask) callsQDialog::exec()directly, which is forbidden outside the main thread:Root cause: The dependency installation routine runs inside a
QgsTaskand opens aQDialogfrom that background thread. On macOS (especially Apple Silicon), AppKit enforces strict main-thread-only UI access and throws anNSException, which propagates as a C++ exception and causesabort().This does not appear to affect Windows or Linux, where the restriction is not enforced at the OS level.
Workaround
Install all required packages manually into QGIS's Python environment before launching QGIS:
Doesn't work.