Created attachment 148289 [details] gdb backtrace SUMMARY When more than one window is used, closing windows one by one terminates Krita with segmentation fault. Segmentation fault message is visible in console and can be analyzed with gdb. Crash rather than normal termination may prevent saving state on exit. *** STEPS TO REPRODUCE 1. Start krita from the command line, so that the terminal output is visible. 2. Open one picture. 3. Open another picture in a new window, using Window -> New Window from menu. 4. Close both windows, starting from the last opened window. Sometimes the crash happens when closing the first window, sometimes when another but I have never seen a clean exit at this point. At this step Krita will terminate with segmentation fault message in console. Or, if running under gdb, the following message will appear: Thread 1 "krita" received signal SIGSEGV, Segmentation fault. KoToolProxy::priv (this=0x0) at kritadev/krita/libs/flake/KoToolProxy.cpp:495 495 return d; OBSERVED RESULT Segmentation fault EXPECTED RESULT Normal exit SOFTWARE/OS VERSIONS Ubuntu Mate 20.04. Standard build as recommended in documentation. Master branch commit 6419e038185a3377f638d26e34588a56c0f71cd8 . ADDITIONAL INFORMATION From the code analysis looks like the crash happens because 'this' is null in KisToolProxy::activateToolAction. The bug can be suppressed by adding check if (this == nullptr) return at the start of this method, but some more in depth analysis would probably be beneficial, maybe we should not get there starting from.
Git commit 805c9327fd55fcbbcce6fba6d15d719068cb8ab4 by Mathias Wein. Committed on 27/05/2022 at 13:29. Pushed by mwein into branch 'master'. Fix crash when closing multiple main windows There is a global state in KisAbstractInputAction that needs to be set correctly whenever they are called. (That entire tool code really could do with an overhaul...it wasn't designed with multiple independent main windows in mind.) M +6 -0 libs/ui/input/kis_input_manager.cpp https://invent.kde.org/graphics/krita/commit/805c9327fd55fcbbcce6fba6d15d719068cb8ab4