-
Notifications
You must be signed in to change notification settings - Fork 109
Description
Bug Report: ITK-SNAP crashes on drag and drop (QUrl constructor failure)
Environment
- ITK-SNAP Version: 4.4.0-20250909-Linux-gcc64
- OS: CachyOS (Arch-based Linux)
- Qt Version: Qt6 (libQt6Core.so.6, libQt6Widgets.so.6, libQt6Gui.so.6)
- Installation Path:
/opt/itksnap-4.4.0-20250909-Linux-gcc64/
Description
ITK-SNAP crashes immediately and consistently when performing a drag and drop operation of any file (images, DICOM folders, etc.) into the main window. The application terminates without any error dialog or recovery option.
Steps to Reproduce
- Launch ITK-SNAP 4.4.0
- Drag any image file (NIfTI, DICOM, etc.) from file manager
- Drop the file onto the ITK-SNAP main window
- Result: Application crashes immediately
Expected Behavior
The drag and drop should:
- Open the file dialog to select import options
- Load the image into ITK-SNAP
- Display the image in the viewer
Actual Behavior
- Application crashes with segmentation fault
- No error dialog is shown
- Application terminates completely
Stack Trace
From journalctl logs, the crash occurs in the dropEvent handler:
Stack trace of thread:
#0 0x00007fc8da95b304 _ZN4QUrlC1ERKS_ (libQt6Core.so.6 + 0x15b304)
#1 0x000055d057122a7a _ZN15MainImageWindow9dropEventEP10QDropEvent (/opt/itksnap-4.4.0-20250909-Linux-gcc64/lib/snap-4.4.0/ITK-SNAP + 0x1121a7a)
#2 0x00007fc8dc9f0a6e _ZN7QWidget5eventEP6QEvent (libQt6Widgets.so.6 + 0x1f0a6e)
#3 0x00007fc8dc9907b6 _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent (libQt6Widgets.so.6 + 0x1907b6)
#4 0x00007fc8dc9999fd _ZN12QApplication6notifyEP7QObjectP6QEvent (libQt6Widgets.so.6 + 0x1999fd)
#5 0x00007fc8da97c9e2 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent (libQt6Core.so.6 + 0x17c9e2)
#6 0x00007fc8dca0634e n/a (libQt6Widgets.so.6 + 0x20634e)
#7 0x00007fc8dca0700d n/a (libQt6Widgets.so.6 + 0x20700d)
#8 0x00007fc8dc9907b6 _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent (libQt6Widgets.so.6 + 0x1907b6)
#9 0x00007fc8da97c9e2 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent (libQt6Core.so.6 + 0x17c9e2)
#10 0x00007fc8dbde97f3 _ZN22QGuiApplicationPrivate11processDropEP7QWindowPK9QMimeDataRK6QPoint6QFlagsIN2Qt10DropActionEES8_INS9_11MouseButtonEES8_INS9_16KeyboardModifierEE (libQt6Gui.so.6 + 0x1e97f3)
#11 0x00007fc8dbe4a885 _ZN22QWindowSystemInterface10handleDropEP7QWindowPK9QMimeDataRK6QPoint6QFlagsIN2Qt10DropActionEES8_INS9_11MouseButtonEES8_INS9_16KeyboardModifierEE (libQt6Gui.so.6 + 0x24a885)
Root Cause
The crash occurs in MainImageWindow::dropEvent at line 1381 in GUI/Qt/Windows/MainImageWindow.cxx. The issue appears to be in the QUrl copy constructor (_ZN4QUrlC1ERKS_), suggesting a memory management issue or improper URL handling.
Workaround
Use File → Open Images... (Ctrl+O) menu instead of drag and drop.
Related Issues
This appears to be related to ongoing drag and drop issues:
- ITK snap crashes when loading incorrect label file #154 - ITK snap crashes when loading incorrect label file
- ITK-snap master can not open DICOM #147 - ITK-snap master can not open DICOM (drag and drop issue)
- Dicom series instance drag/drop doesn't open dialog to select series #132 - Dicom series instance drag/drop doesn't open dialog
Additional Information
- The crash is reproducible 100% of the time
- It occurs with all file types (tested with various medical imaging formats)
- Using
File → Openworks perfectly with the same files - Multiple crash dumps have been generated by systemd-coredump
Suggested Fix
Review the MainImageWindow::dropEvent() implementation for:
- Proper QUrl lifetime management
- Correct copy/move semantics with Qt6
- Null pointer checks before URL operations
- Exception handling around MIME data processing
Would appreciate any guidance or patches for this critical usability issue.