Repository navigation
Conversation
main.py called ctypes.windll.kernel32.CreateMutexW unconditionally, which crashes on Linux/macOS with 'AttributeError: module ctypes has no attribute windll' before the UI starts. - Guard all ctypes.windll usage behind sys.platform == 'win32' - Use an fcntl.flock advisory lock for the single-instance guard on POSIX - Add LINUX_FIX.md with the diagnosis and run instructions Verified launching on Kali Linux with Python 3.12 + PySide6 6.11.1.
|
Hi @zaddi-1k, Thank you for your contribution and for identifying and fixing the Linux startup crash with Before we can merge this PR, please address the following points:
Once you update the branch by keeping only the |
Summary
The Linux and macOS builds crash before the UI appears:
ctypes.windllis a Windows-only attribute.main.pycalls it unconditionallyfor the single-instance guard, so on any non-Windows platform the application
dies during bootstrap.
Reproduction
# Kali Linux / Debian, v1.7.14 AppImage from the releases page chmod +x DrawMotion-x86_64.AppImage ./DrawMotion-x86_64.AppImageFails 100% of the time, immediately, before Qt starts.
Fix
sys.platform == "win32", and use anfcntl.flockadvisory lock on POSIX.ctypes.windll.user32.MessageBoxWin_install_native_crash_handler.ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID.The two
windllcalls inmain.pywere already insidetry/exceptfor thetaskbar call, but the crash handler's
MessageBoxWand the mutex were not.Verification
Tested on Kali Linux (rolling), Python 3.12.16, with the pinned
requirements.txt(PySide6 6.11.1, opencv-contrib-python 5.0.0.93,numpy 2.5.1):
python main.pyreaches the Project Hub with[BOOT_HEALTHY] Startup completed cleanly with zero errors.[MUTEX_BLOCKED] Another instance of DrawMotion_Dev_Mutex is already active.and exits, matching the Windows behaviour.
build-linux.ymlworkflow completes and produces a workingAppImage / .deb / tarball.
Windows behaviour is unchanged — the original code path is preserved under the
platform check.
Notes
LINUX_FIX.mddocuments the diagnosis and how to run from source. Happy toadjust the approach (e.g. use
QLockFileinstead offcntl) if you prefer.