Bug 510037 - Editing fill layer quickly crashes krita, because `m_view` is nullptr in `KisDlgGeneratorLayer::saveLayer`
Summary: Editing fill layer quickly crashes krita, because `m_view` is nullptr in `Kis...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: * Unknown (other bugs)
Version First Reported In: git master (please specify the git hash!)
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-29 02:59 UTC by Ming Chuan
Modified: 2025-11-20 16:13 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ming Chuan 2025-09-29 02:59:05 UTC
SUMMARY

Example stack trace at the end of bug report

STEPS TO REPRODUCE
1. Create a new moderately large document (e.g. 10000x10000 pixels)
2. Add a fill layer, choose simplex noise, set frequency to 500, click OK
3. In the Layers docker, right-click the fill layer created in step 2, and select Properties. Change the frequency to another high value (e.g., 490), click OK
4. Krita would crash, if not, repeat step 3, and maybe try click faster

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS

Qt 6.9.2, recent krita git master

ADDITIONAL INFORMATION

```
#0  KisViewManager::document (this=0x0) at /home/user/sources/krita/libs/ui/KisViewManager.cpp:874
#1  0x00007ffff762eaec in KisDlgGeneratorLayer::saveLayer (this=0x7ffca1797790) at /home/user/sources/krita/libs/ui/dialogs/kis_dlg_generator_layer.cpp:95
#2  0x00007ffff3025ab8 in doActivate<false> (sender=0x7ffca1797790, signal_index=8, argv=0x7ffffffdb328) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qobject.cpp:4169
#3  0x00007ffff301b747 in QMetaObject::activate (sender=sender@entry=0x7ffca1797790, m=m@entry=0x7ffff49e90a0 <QDialog::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qobject.cpp:4217
#4  0x00007ffff465a0d7 in QDialog::accepted (this=this@entry=0x7ffca1797790) at /build/qtbase-everywhere-src-6.9.2/build/src/widgets/Widgets_autogen/include/moc_qdialog.cpp:196
#5  0x00007ffff465b158 in QDialog::done (this=0x7ffca1797790, r=1) at /build/qtbase-everywhere-src-6.9.2/src/widgets/dialogs/qdialog.cpp:620
#6  0x00007ffff3025ab8 in doActivate<false> (sender=0x7ffca3f254b0, signal_index=8, argv=0x7ffffffdb448) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qobject.cpp:4169
#7  0x00007ffff301b747 in QMetaObject::activate (sender=sender@entry=0x7ffca3f254b0, m=m@entry=0x7ffff49e08e0 <QDialogButtonBox::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qobject.cpp:4217
#8  0x00007ffff45d2007 in QDialogButtonBox::accepted (this=this@entry=0x7ffca3f254b0) at /build/qtbase-everywhere-src-6.9.2/build/src/widgets/Widgets_autogen/include/moc_qdialogbuttonbox.cpp:221
#9  0x00007ffff45d2c78 in QDialogButtonBoxPrivate::handleButtonClicked (this=<optimized out>) at /build/qtbase-everywhere-src-6.9.2/src/widgets/widgets/qdialogbuttonbox.cpp:891
#10 0x00007ffff30257ee in QtPrivate::QSlotObjectBase::call (this=0x3cb8a190, r=<optimized out>, a=0x7ffffffdb5d0) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qobjectdefs_impl.h:461
#11 doActivate<false> (sender=0x12034d20, signal_index=9, argv=0x7ffffffdb5d0) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qobject.cpp:4157
#12 0x00007ffff301b747 in QMetaObject::activate (sender=sender@entry=0x12034d20, m=m@entry=0x7ffff49d5e60 <QAbstractButton::staticMetaObject>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7ffffffdb5d0) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qobject.cpp:4217
#13 0x00007ffff44f0b44 in QMetaObject::activate<void, bool> (sender=0x12034d20, mo=0x7ffff49d5e60 <QAbstractButton::staticMetaObject>, local_signal_index=2, ret=0x0) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qobjectdefs.h:306
#14 QAbstractButton::clicked (this=this@entry=0x12034d20, _t1=<optimized out>) at /build/qtbase-everywhere-src-6.9.2/build/src/widgets/Widgets_autogen/include/moc_qabstractbutton.cpp:252
#15 0x00007ffff44f0dff in QAbstractButtonPrivate::emitClicked (this=0x3c500bd0) at /build/qtbase-everywhere-src-6.9.2/src/widgets/widgets/qabstractbutton.cpp:381
#16 0x00007ffff44f264f in QAbstractButtonPrivate::click (this=0x3c500bd0) at /build/qtbase-everywhere-src-6.9.2/src/widgets/widgets/qabstractbutton.cpp:374
#17 0x00007ffff44f2885 in QAbstractButton::mouseReleaseEvent (this=0x12034d20, e=0x7ffffffdbcc0) at /build/qtbase-everywhere-src-6.9.2/src/widgets/widgets/qabstractbutton.cpp:976
#18 0x00007ffff440db08 in QWidget::event (this=0x12034d20, event=0x7ffffffdbcc0) at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qwidget.cpp:9363
#19 0x00007ffff43a1c2d in QApplicationPrivate::notify_helper (this=this@entry=0xe8c830, receiver=receiver@entry=0x12034d20, e=e@entry=0x7ffffffdbcc0) at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qapplication.cpp:3300
#20 0x00007ffff43acb32 in QApplication::notify (this=this@entry=0x7ffffffdcb40, receiver=receiver@entry=0x12034d20, e=e@entry=0x7ffffffdbcc0) at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qapplication.cpp:2777
#21 0x00007ffff7b11dae in KisApplication::notify (this=0x7ffffffdcb40, receiver=0x12034d20, event=0x7ffffffdbcc0) at /home/user/sources/krita/libs/ui/KisApplication.cpp:864
#22 0x00007ffff2fb76f8 in QCoreApplication::notifyInternal2 (receiver=0x12034d20, event=0x7ffffffdbcc0) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qcoreapplication.cpp:1106
#23 0x00007ffff2fb796d in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qcoreapplication.cpp:1560
#24 0x00007ffff43ab459 in QApplicationPrivate::sendMouseEvent (receiver=receiver@entry=0x12034d20, event=event@entry=0x7ffffffdbcc0, alienWidget=<optimized out>, alienWidget@entry=0x12034d20, nativeWidget=nativeWidget@entry=0x7ffca1797790, buttonDown=buttonDown@entry=0x7ffff4a109f0 <qt_button_down>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false)
    at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qapplication.cpp:2358
#25 0x00007ffff4423393 in QWidgetWindow::handleMouseEvent (this=0x7ffc8f329cf0, event=event@entry=0x7ffffffdc030) at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qwidgetwindow.cpp:683
#26 0x00007ffff4425e10 in QWidgetWindow::event (this=0x7ffc8f329cf0, event=0x7ffffffdc030) at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qwidgetwindow.cpp:292
#27 0x00007ffff43a1c2d in QApplicationPrivate::notify_helper (this=this@entry=0x0, receiver=0x7ffc8f329cf0, e=0x7ffffffdc030, e@entry=0x7fffdc01fb80) at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qapplication.cpp:3300
#28 0x00007ffff43abf77 in QApplication::notify (this=this@entry=0x7ffffffdcb40, receiver=receiver@entry=0x7ffc8f329cf0, e=0x7fffdc01fb80, e@entry=0x7ffffffdc030) at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qapplication.cpp:3061
#29 0x00007ffff7b11dae in KisApplication::notify (this=0x7ffffffdcb40, receiver=0x7ffc8f329cf0, event=0x7ffffffdc030) at /home/user/sources/krita/libs/ui/KisApplication.cpp:864
#30 0x00007ffff2fb76f8 in QCoreApplication::notifyInternal2 (receiver=0x7ffc8f329cf0, event=0x7ffffffdc030) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qcoreapplication.cpp:1106
#31 0x00007ffff2fb796d in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qcoreapplication.cpp:1560
#32 0x00007ffff3807586 in QGuiApplicationPrivate::processMouseEvent (e=0x7fffa4bf1f50) at /build/qtbase-everywhere-src-6.9.2/src/gui/kernel/qguiapplication.cpp:2476
#33 0x00007ffff3877174 in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at /build/qtbase-everywhere-src-6.9.2/src/gui/kernel/qwindowsysteminterface.cpp:1117
#34 0x00007ffff38773b0 in QWindowSystemInterface::flushWindowSystemEvents (flags=...) at /build/qtbase-everywhere-src-6.9.2/src/gui/kernel/qwindowsysteminterface.cpp:1086
#35 0x00007ffff301694a in QObject::event (this=0xe860a0, e=0x7fffd8009ba0) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qobject.cpp:1432
#36 0x00007ffff43a1c2d in QApplicationPrivate::notify_helper (this=this@entry=0x13bc960, receiver=0xe860a0, e=0x7fffd8009ba0, e@entry=0x13bc958) at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qapplication.cpp:3300
#37 0x00007ffff43abf77 in QApplication::notify (this=this@entry=0x7ffffffdcb40, receiver=receiver@entry=0xe860a0, e=0x13bc958, e@entry=0x7fffd8009ba0) at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qapplication.cpp:3061
#38 0x00007ffff7b11dae in KisApplication::notify (this=0x7ffffffdcb40, receiver=0xe860a0, event=0x7fffd8009ba0) at /home/user/sources/krita/libs/ui/KisApplication.cpp:864
#39 0x00007ffff2fb76f8 in QCoreApplication::notifyInternal2 (receiver=0xe860a0, event=0x7fffd8009ba0) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qcoreapplication.cpp:1106
#40 0x00007ffff2fb795d in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qcoreapplication.cpp:1546
#41 0x00007ffff2fbb5e8 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0xb92880) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qcoreapplication.cpp:1891
#42 0x00007ffff32e64ff in postEventSourceDispatch (s=0x13b46e0) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qeventdispatcher_glib.cpp:246
#43 0x00007ffff2503f2d in g_main_context_dispatch_unlocked () from /nix/store/qfm3kqdbpd289nnmdhd4dis4svd2nzwv-glib-2.84.4/lib/libglib-2.0.so.0
#44 0x00007ffff2506278 in g_main_context_iterate_unlocked.isra () from /nix/store/qfm3kqdbpd289nnmdhd4dis4svd2nzwv-glib-2.84.4/lib/libglib-2.0.so.0
#45 0x00007ffff2506b0f in g_main_context_iteration () from /nix/store/qfm3kqdbpd289nnmdhd4dis4svd2nzwv-glib-2.84.4/lib/libglib-2.0.so.0
#46 0x00007ffff32e5bb1 in QEventDispatcherGlib::processEvents (this=0xeb33f0, flags=...) at /build/qtbase-everywhere-src-6.9.2/src/corelib/kernel/qeventdispatcher_glib.cpp:401
#47 0x00007ffff2fc649b in QEventLoop::exec (this=this@entry=0x7ffffffdc780, flags=..., flags@entry=...) at /build/qtbase-everywhere-src-6.9.2/src/corelib/global/qflags.h:77
#48 0x00007ffff2fc1501 in QCoreApplication::exec () at /build/qtbase-everywhere-src-6.9.2/src/corelib/global/qflags.h:77
#49 0x00007ffff37f363d in QGuiApplication::exec () at /build/qtbase-everywhere-src-6.9.2/src/gui/kernel/qguiapplication.cpp:1986
#50 0x00007ffff43a1b99 in QApplication::exec () at /build/qtbase-everywhere-src-6.9.2/src/widgets/kernel/qapplication.cpp:2567
#51 0x0000000000409fce in main (argc=<optimized out>, argv=<optimized out>) at /home/user/sources/krita/krita/main.cc:802
```
Comment 1 Ming Chuan 2025-09-29 08:42:47 UTC
Just some extra info, I can confirm the crash also happens with linux qt6 build of krita-6.0.0-prealpha-a65769cd52-x86_64.AppImage (running under XWayland. Unrelatedly, Krita’s Wayland implementation appears to be broken on my compositor at the moment, haven’t investigated it yet)
Comment 2 Freya Lupen 2025-09-29 16:53:03 UTC
Confirmed (on 93c283a3). I couldn't get it to crash on Qt5, but not sure whether it could be Qt6-specific.
Comment 3 Dmitry Kazakov 2025-11-20 16:13:15 UTC
Git commit 222e39d22a0981ffd6e87069370a9524405fdda7 by Dmitry Kazakov, on behalf of Luna Lovecraft.
Committed on 20/11/2025 at 16:13.
Pushed by dkazakov into branch 'master'.

Fixed a crash when changing fill layer settings

Test Plan
---------
1. Build using Qt6
2. Create a new moderately large document (e.g. 10000x10000 pixels)
3. Add a fill layer, choose simplex noise, set frequency to 500, click OK
4. In the Layers docker, right-click the fill layer created in step 2, and select Properties. Change the frequency to another high value (e.g., 490), click OK

M  +12   -2    libs/ui/dialogs/kis_dlg_generator_layer.cpp

https://invent.kde.org/graphics/krita/-/commit/222e39d22a0981ffd6e87069370a9524405fdda7