Bug 445329

Summary: Krita crashes when closing the "Configure Krita" dialogue with the "X" close icon
Product: [Applications] krita Reporter: Timo Gurr <timo.gurr>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahab.greybeard, halla
Priority: NOR    
Version: 4.4.8   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: coredump.txt
krita_segfault.png

Description Timo Gurr 2021-11-11 12:50:11 UTC
Created attachment 143445 [details]
coredump.txt

SUMMARY
Krita crashes when closing the "Configure Krita" dialogue with the window manager decoration "close/X" button instead of the "Cancel" button on the buttom. The bug doesn't seem to apply to other dialogues closed in the same way like for example "Open a document" or "configure toolbars" and so on.

STEPS TO REPRODUCE
1.  Compile Krita 4.4.8
2.  Run it
3.  Click "Settings" -> "Configure Krita"
4.  Close that windows via the "X" close button from the window manager decoration bar next to minmize/maximize

OBSERVED RESULT
Segfault

EXPECTED RESULT
No segfault, behave like when clicking the "Close" button.

SOFTWARE/OS VERSIONS
Operating System: Exherbo
KDE Plasma Version: 5.23.2
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2 (qtbase kde/5.15 branch fixes up to 5.15.2_p254)
Kernel Version: 5.15.1 (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i5-6500 CPU @ 3.20GHz
Memory: 11.5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 530

ADDITIONAL INFORMATION
Used CMake options during build:

cmake -DCMAKE_COLOR_MAKEFILE:BOOL=TRUE -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_FLAGS:STRING=-march=native -O2 -pipe -DCMAKE_CXX_FLAGS:STRING=-march=native -O2 -pipe -DCMAKE_AR:PATH=x86_64-pc-linux-gnu-ar -DCMAKE_RANLIB:PATH=x86_64-pc-linux-gnu-ranlib -DCMAKE_NM:PATH=x86_64-pc-linux-gnu-nm -DCMAKE_C_COMPILER:PATH=x86_64-pc-linux-gnu-cc -DCMAKE_CXX_COMPILER:PATH=x86_64-pc-linux-gnu-c++ -DCMAKE_INSTALL_PREFIX:PATH=/usr/x86_64-pc-linux-gnu -DCMAKE_FIND_ROOT_PATH=/usr/x86_64-pc-linux-gnu -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM:STRING=NEVER -DCMAKE_SYSTEM_PREFIX_PATH:PATH=/usr/x86_64-pc-linux-gnu -DCMAKE_INSTALL_LIBDIR:STRING=lib -DCMAKE_INSTALL_DATAROOTDIR:PATH=/usr/share/ -DBUILD_COVERAGE:BOOL=FALSE -DBUILD_KRITA_QT_DESIGNER_PLUGINS:BOOL=FALSE -DBUILD_SHARED_LIBS:BOOL=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_KSeExpr:BOOL=TRUE -DCRASH_ON_SAFE_ASSERTS:BOOL=FALSE -DENABLE_CPU_THROTTLE:BOOL=FALSE -DHAVE_BACKTRACE_SUPPORT:BOOL=FALSE -DHAVE_MEMORY_LEAK_TRACKER:BOOL=FALSE -DHIDE_SAFE_ASSERTS:BOOL=TRUE -DKRITA_ENABLE_BROKEN_TESTS:BOOL=FALSE -DLIMIT_LONG_TESTS:BOOL=TRUE -DUSE_LOCK_FREE_HASH_TABLE:BOOL=TRUE -DFOUNDATION_BUILD:BOOL=FALSE -DENABLE_PYTHON_2:BOOL=FALSE -DKRITA_DEVS:BOOL=FALSE -DBUILD_SHARED_LIBS:BOOL=TRUE -DKDE_INSTALL_AUTOSTARTDIR=/etc/xdg/autostart -DKDE_INSTALL_CONFDIR=/etc/xdg -DKDE_INSTALL_DATAROOTDIR:PATH=/usr/share -DKDE_INSTALL_LIBEXECDIR=libexec -DKDE_INSTALL_SYSCONFDIR=/etc -DKDE_INSTALL_USE_QT_SYS_PATHS:BOOL=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_FFTW3:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_OpenColorIO:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_HEIF:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_OpenJPEG:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_OpenEXR:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_Poppler:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_PythonInterp:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_PythonLibrary:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_SIP:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_PyQt5:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_LibRaw:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Multimedia:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_TIFF:BOOL=FALSE -DCMAKE_DISABLE_FIND_PACKAGE_Vc:BOOL=TRUE -DBUILD_TESTING:BOOL=FALSE /var/tmp/paludis/build/media-gfx-krita-4.4.8/work/krita-4.4.8

Attached you'll find, the hopefully useful, coredump.

Application: Krita (krita), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f9ab64023a2 in KisImageConfig::setDefaultProofingConfig (this=this@entry=0x7ffffc198f00, proofingSpace=0x0, proofingIntent=proofingIntent@entry=3, blackPointCompensation=blackPointCompensation@entry=true, warningColor=..., adaptationState=4.6656091129964288e-310, adaptationState@entry=1) at /var/tmp/paludis/build/media-gfx-krita-4.4.8/work/krita-4.4.8/libs/image/kis_image_config.cpp:512
#5  0x00007f9ab72ad323 in KisDlgPreferences::editPreferences (this=this@entry=0x7f9aa80087d0) at /var/tmp/paludis/build/media-gfx-krita-4.4.8/work/krita-4.4.8/libs/ui/dialogs/kis_dlg_preferences.cc:1785
#6  0x00007f9ab76799f6 in KisMainWindow::slotPreferences (this=0x55e2ec893370) at /var/tmp/paludis/build/media-gfx-krita-4.4.8/work/krita-4.4.8/libs/ui/KisMainWindow.cpp:750
#7  0x00007f9ab4e9b51d in void doActivate<false>(QObject*, int, void**) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Core.so.5
#8  0x00007f9ab5947a12 in QAction::triggered(bool) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#9  0x00007f9ab594a3c4 in QAction::activate(QAction::ActionEvent) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#10 0x00007f9ab5abc222 in QMenuPrivate::activateCausedStack(QVector<QPointer<QWidget> > const&, QAction*, QAction::ActionEvent, bool) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#11 0x00007f9ab5ac37ff in QMenuPrivate::activateAction(QAction*, QAction::ActionEvent, bool) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#12 0x00007f9ab598bf38 in QWidget::event(QEvent*) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#13 0x00007f9ab594d9bf in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#14 0x00007f9ab5954df3 in QApplication::notify(QObject*, QEvent*) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#15 0x00007f9ab76450c9 in KisApplication::notify (this=<optimized out>, receiver=0x55e2ee25e490, event=0x7ffffc1996f0) at /var/tmp/paludis/build/media-gfx-krita-4.4.8/work/krita-4.4.8/libs/ui/KisApplication.cpp:710
#16 0x00007f9ab4e65d50 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Core.so.5
#17 0x00007f9ab5953993 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#18 0x00007f9ab59a4b67 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#19 0x00007f9ab59a6f75 in QWidgetWindow::event(QEvent*) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#20 0x00007f9ab594d9bf in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Widgets.so.5
#21 0x00007f9ab76450c9 in KisApplication::notify (this=<optimized out>, receiver=0x55e2ee2e7510, event=0x7ffffc199a10) at /var/tmp/paludis/build/media-gfx-krita-4.4.8/work/krita-4.4.8/libs/ui/KisApplication.cpp:710
#22 0x00007f9ab4e65d50 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Core.so.5
#23 0x00007f9ab524154f in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Gui.so.5
#24 0x00007f9ab52194db in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Gui.so.5
#25 0x00007f9aaf71afca in xcbSourceDispatch(_GSource*, int (*)(void*), void*) () from /usr/x86_64-pc-linux-gnu/lib/libQt5XcbQpa.so.5
#26 0x00007f9ab234f5cb in g_main_dispatch (context=0x7f9aa8005000) at ../glib-2.70.0/glib/gmain.c:3381
#27 g_main_context_dispatch (context=0x7f9aa8005000) at ../glib-2.70.0/glib/gmain.c:4099
#28 0x00007f9ab234f838 in g_main_context_iterate (context=context@entry=0x7f9aa8005000, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib-2.70.0/glib/gmain.c:4175
#29 0x00007f9ab234f8df in g_main_context_iteration (context=0x7f9aa8005000, may_block=1) at ../glib-2.70.0/glib/gmain.c:4240
#30 0x00007f9ab4ebc80e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Core.so.5
#31 0x00007f9ab4e648c3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/x86_64-pc-linux-gnu/lib/libQt5Core.so.5
#32 0x00007f9ab4e6c94c in QCoreApplication::exec() () from /usr/x86_64-pc-linux-gnu/lib/libQt5Core.so.5
#33 0x000055e2e1c0d678 in main (argc=<optimized out>, argv=0x7ffffc19a0a8) at /var/tmp/paludis/build/media-gfx-krita-4.4.8/work/krita-4.4.8/krita/main.cc:669
[Inferior 1 (process 589) detached]
Comment 1 Ahab Greybeard 2021-11-11 19:22:55 UTC
I don't see a crash or any entries in the log or terminal when trying this on a Debian 10 system running appimages from 4.4.8 onwards.

Note re. Step 4: I don't have a 'minimise' or 'maximise' along the top, only the 'X' button.
Comment 2 Timo Gurr 2021-11-11 20:03:07 UTC
Created attachment 143466 [details]
krita_segfault.png

Attaching screenshot to illustrate / make clear which button I'm referring to.
Comment 3 Ahab Greybeard 2021-11-11 20:14:19 UTC
On that Configure Krita window, I don't have the 'maximise' and 'minimise' buttons, only the 'X' button.
This may be related to my OS and/or desktop manager, I don't know.
Comment 4 Halla Rempt 2021-11-12 09:12:29 UTC
This only happens because of an unusual combination of present and absent dependencies, it won't happen in a supported build.
Comment 5 Timo Gurr 2021-11-12 09:48:07 UTC
(In reply to Halla Rempt from comment #4)
> This only happens because of an unusual combination of present and absent
> dependencies, it won't happen in a supported build.

Can you please give any details? The only optional external dependencies disabled in this build appear to be KSeExpr & Vc. Will you still look into it considering krita offers the options? I don't consider this a major issue though like the crashes on startup I experienced before that you've fixed in no time and allowed us update our package to the latest stable version, thanks again for that! Thanks for any help & information!
Comment 6 Halla Rempt 2021-11-12 09:56:44 UTC
Ah, I misread the cmake statement, I thought a lot of stuff was still disabled. This is weird, though, since the crash is still because of a null pointer for a profile.
Comment 7 Halla Rempt 2022-07-12 10:23:24 UTC
Git commit ea9b990aeb3b649a69f8a670dc6398668ce8b5fe by Halla Rempt.
Committed on 12/07/2022 at 10:22.
Pushed by rempt into branch 'master'.

Check pointer before dereferencing

M  +4    -0    libs/image/kis_image_config.cpp

https://invent.kde.org/graphics/krita/commit/ea9b990aeb3b649a69f8a670dc6398668ce8b5fe
Comment 8 Halla Rempt 2022-07-12 10:23:40 UTC
Git commit 17a635d90e9dcf5ccbb16cca06ceaeb083a7eca1 by Halla Rempt.
Committed on 12/07/2022 at 10:23.
Pushed by rempt into branch 'krita/5.1'.

Check pointer before dereferencing
(cherry picked from commit ea9b990aeb3b649a69f8a670dc6398668ce8b5fe)

M  +4    -0    libs/image/kis_image_config.cpp

https://invent.kde.org/graphics/krita/commit/17a635d90e9dcf5ccbb16cca06ceaeb083a7eca1