SUMMARY Sometimes, when swiping left on a touch screen, a segmentation fault happens at documentview.cpp:847 because `d->mAdapter->imageView()` is `nullptr`. STEPS TO REPRODUCE 1. Open an image in a folder with multiple images 2. Swipe left ( = advance to right) a few times Unfortunately, this is not reproducible 100% of the time. I have noticed that the issue does not occur with short swipes for example. OBSERVED RESULT Segmentation fault, crash EXPECTED RESULT Go to next image SOFTWARE/OS VERSIONS Operating System: openSUSE Tumbleweed 20250912 KDE Plasma Version: 6.4.5 KDE Frameworks Version: 6.17.0 Qt Version: 6.9.2 ADDITIONAL INFORMATION If I had to guess, I'd say this happens when the image has already changed or is in the process of changing. Long swipes trigger an image change before the "end" of the gesture. Maybe the `imageView` does not always remain valid in this process. To be excessively clear, I assume the following steps happen in succession. 1. Gesture is triggered because the configured length has been reached. Page change is requested 2. `imageView` is invalidated 3. Fingers are lifted, which triggers the swipe condition again. 4. Segmentation fault, because the new image was not loaded yet. If this is indeed the case, we could simply drop a swipe event if there is no valid image view. However, I do not know the codebase well enough to confirm this. Another, probably cleaner solution, would be to keep the `imageView` around until the new image is fully loaded, and exchange them atomically, though maybe there's more than one pointer to exchange. Backtrace: #0 0x00007ffff7cf8bf9 in Gwenview::AbstractImageView::dipDocumentSize (this=0x0) at /home/Thomas/dev/gwenview/lib/documentview/abstractimageview.cpp:186 #1 0x00007ffff7d03ded in Gwenview::DocumentView::swipeLeft (this=0x1c5bf30) at /home/Thomas/dev/gwenview/lib/documentview/documentview.cpp:847 #2 0x00007ffff7d1206a in QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, void, void (Gwenview::DocumentView::*)()>::call(void (Gwenview::DocumentView::*)(), Gwenview::DocumentView*, void**)::{lambda()#1}::operator()() const (__closure=0x7fffffffab50) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:127 #3 0x00007ffff7d12cfd in QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, void, void (Gwenview::DocumentView::*)()>::call(void (Gwenview::DocumentView::*)(), Gwenview::DocumentView*, void**)::{lambda()#1}>(void**, QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, void, void (Gwenview::DocumentView::*)()>::call(void (Gwenview::DocumentView::*)(), Gwenview::DocumentView*, void**)::{lambda()#1}&&) (args=0x7fffffffac88, fn=...) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:65 #4 0x00007ffff7d120cd in QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, void, void (Gwenview::DocumentView::*)()>::call(void (Gwenview::DocumentView::*)(), Gwenview::DocumentView*, void**) (f=(void (Gwenview::DocumentView::*)(Gwenview::DocumentView * const)) 0x7ffff7d03dac <Gwenview::DocumentView::swipeLeft()>, o=0x1c5bf30, arg=0x7fffffffac88) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:126 #5 0x00007ffff7d11162 in QtPrivate::FunctionPointer<void (Gwenview::DocumentView::*)()>::call<QtPrivate::List<>, void>(void (Gwenview::DocumentView::*)(), Gwenview::DocumentView*, void**) (f=(void (Gwenview::DocumentView::*)(Gwenview::DocumentView * const)) 0x7ffff7d03dac <Gwenview::DocumentView::swipeLeft()>, o=0x1c5bf30, arg=0x7fffffffac88) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:174 #6 0x00007ffff7d0fdbf in QtPrivate::QCallableObject<void (Gwenview::DocumentView::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x23cdaf0, r=0x1c5bf30, a=0x7fffffffac88, ret=0x0) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:545 #7 0x00007ffff46308b4 in ??? () at /lib64/libQt6Core.so.6 #8 0x00007ffff7de80d0 in Gwenview::Touch::swipeLeftTriggered (this=0x1c589d0) at /home/Thomas/dev/gwenview/build/lib/gwenviewlib_autogen/include/moc_touch.cpp:188 #9 0x00007ffff7de7361 in Gwenview::Touch::checkOneAndTwoFingerSwipeGesture (this=0x1c589d0, event=0x7fffffffb1d0) at /home/Thomas/dev/gwenview/lib/touch/touch.cpp:282 #10 0x00007ffff7de6c5e in Gwenview::Touch::gestureEvent (this=0x1c589d0, event=0x7fffffffb1d0) at /home/Thomas/dev/gwenview/lib/touch/touch.cpp:170 #11 0x00007ffff7de6a77 in Gwenview::Touch::eventFilter (this=0x1c589d0, event=0x7fffffffb1d0) at /home/Thomas/dev/gwenview/lib/touch/touch.cpp:134 #12 0x00007ffff45c8b17 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /lib64/libQt6Core.so.6 #13 0x00007ffff5be51b8 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt6Widgets.so.6 #14 0x00007ffff45c9138 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt6Core.so.6 #15 0x00007ffff5fed9f4 in ??? () at /lib64/libQt6Widgets.so.6 #16 0x00007ffff6006b61 in ??? () at /lib64/libQt6Widgets.so.6 #17 0x00007ffff5ffbe6f in QGraphicsScene::event(QEvent*) () at /lib64/libQt6Widgets.so.6 #18 0x00007ffff5be51c8 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt6Widgets.so.6 #19 0x00007ffff45c9138 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt6Core.so.6 #20 0x00007ffff60372ee in QGraphicsView::viewportEvent(QEvent*) () at /lib64/libQt6Widgets.so.6 #21 0x00007ffff45c8b17 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /lib64/libQt6Core.so.6 #22 0x00007ffff5be51b8 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt6Widgets.so.6 #23 0x00007ffff5beabf3 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt6Widgets.so.6 #24 0x00007ffff45c9138 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt6Core.so.6 #25 0x00007ffff5c1026a in ??? () at /lib64/libQt6Widgets.so.6 #26 0x00007ffff5bfd87a in ??? () at /lib64/libQt6Widgets.so.6 #27 0x00007ffff5c0003f in ??? () at /lib64/libQt6Widgets.so.6 #28 0x00007ffff5bea98d in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt6Widgets.so.6 #29 0x00007ffff45c9138 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt6Core.so.6 #30 0x00007ffff5be7974 in QApplicationPrivate::translateRawTouchEvent(QWidget*, QTouchEvent const*) () at /lib64/libQt6Widgets.so.6 #31 0x00007ffff5c5a0e1 in ??? () at /lib64/libQt6Widgets.so.6 #32 0x00007ffff5be51c8 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt6Widgets.so.6 #33 0x00007ffff45c9138 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt6Core.so.6 #34 0x00007ffff522f8ac in QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent*) () at /lib64/libQt6Gui.so.6 #35 0x00007ffff529d1fb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt6Gui.so.6 #36 0x00007ffff529d397 in QWindowSystemInterface::flushWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt6Gui.so.6 #37 0x00007ffff4630cde in ??? () at /lib64/libQt6Core.so.6 #38 0x00007ffff487d8ab in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt6Core.so.6 #39 0x00007ffff45d6ab3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt6Core.so.6 #40 0x00007ffff45cda63 in QCoreApplication::exec() () at /lib64/libQt6Core.so.6 #41 0x0000000000494d26 in main (argc=1, argv=0x7fffffffcf48) at /home/Thomas/dev/gwenview/app/main.cpp:250
A possibly relevant merge request was started @ https://invent.kde.org/graphics/gwenview/-/merge_requests/357