Bug 473760 - Krita crashes when saving
Summary: Krita crashes when saving
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 5.2.0-beta2
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: regression, release_blocker
: 472763 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-08-25 21:04 UTC by angel ord
Modified: 2023-08-30 11:29 UTC (History)
2 users (show)

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


Attachments
Krita Crashlog (488.99 KB, text/plain)
2023-08-25 21:04 UTC, angel ord
Details

Note You need to log in before you can comment on or make changes to this bug.
Description angel ord 2023-08-25 21:04:03 UTC
Created attachment 161185 [details]
Krita Crashlog

SUMMARY
***
Krita randomly Crashes whithout warning when saving
***


STEPS TO REPRODUCE
1. open krita
2. open .kra file
3. work on krita kra file 
4. save, either manually (file>save /file>save as...) or pressing ctrl + s / ctrl + alt + s

OBSERVED RESULT
Krita closes itself, no warning, no freezing and the file doesnt save

EXPECTED RESULT
the file is saved, Krita is still open and can continue to work on the file

SOFTWARE/OS VERSIONS
Windows 10 home


ADDITIONAL INFORMATION
Comment 1 Dmitry Kazakov 2023-08-28 08:14:46 UTC
Hi, Angel!

Thank you very much for your report! I will try to look into it...
Comment 2 Dmitry Kazakov 2023-08-30 09:05:00 UTC
The problem happens in line 276 in KisPlaybackEngineQT::throttledDriverCallback(). It seems like `m_d->measure` is null by the time of the call. The problem is that two lines above Krita writes(!) into the same location, so, most probably, some recursion happens in `bool neededRefresh = displayProxy->displayFrame(targetFrame, false)` function call... :(


        269 [1]	        if (currentFrame != targetFrame) {
0x7ffc752fe3a4  <+  868>        41 39 c4                    cmp    %eax,%r12d
0x7ffc752fe3a7  <+  871>        74 36                       je     0x7ffc752fe3df <_ZN19KisPlaybackEngineQT23throttledDriverCallbackEv+927>
        C:/Packaging/KritaWS/deps-install/include/QtCore/qscopedpointer.h:
0x7ffc752fe3a9  <+  873>        48 8b 4e 28                 mov    0x28(%rsi),%rcx
0x7ffc752fe3ad  <+  877>        48 8b 11                    mov    (%rcx),%rdx
0x7ffc752fe3b0  <+  880>        48 8b 49 08                 mov    0x8(%rcx),%rcx
        106 [1]	    return m_dropFrames;
0x7ffc752fe3b4  <+  884>        0f b6 52 3c                 movzbl 0x3c(%rdx),%edx
        271 [1]	            m_d->measure->waitingForFrame = !m_d->driver->dropFrames();
0x7ffc752fe3b8  <+  888>        80 f2 01                    xor    $0x1,%dl
0x7ffc752fe3bb  <+  891>        88 51 18                    mov    %dl,0x18(%rcx)
        273 [1]	            bool neededRefresh = displayProxy->displayFrame(targetFrame, false);
0x7ffc752fe3be  <+  894>        48 89 f9                    mov    %rdi,%rcx
0x7ffc752fe3c1  <+  897>        89 c2                       mov    %eax,%edx
0x7ffc752fe3c3  <+  899>        45 31 c0                    xor    %r8d,%r8d
0x7ffc752fe3c6  <+  902>        e8 b5 c6 37 00              call   0x7ffc7567aa80 <_ZN20KisFrameDisplayProxy12displayFrameEib>
        C:/Packaging/KritaWS/deps-install/include/QtCore/qscopedpointer.h:
0x7ffc752fe3cb  <+  907>        48 8b 4e 28                 mov    0x28(%rsi),%rcx
0x7ffc752fe3cf  <+  911>        48 8b 49 08                 mov    0x8(%rcx),%rcx
        276 [1]	            m_d->measure->waitingForFrame = m_d->measure->waitingForFrame && neededRefresh;
0x7ffc752fe3d3  <+  915>        80 79 18 00                 cmpb   $0x0,0x18(%rcx)
0x7ffc752fe3d7  <+  919>        0f 95 c2                    setne  %dl
0x7ffc752fe3da  <+  922>        20 c2                       and    %al,%dl
0x7ffc752fe3dc  <+  924>        88 51 18                    mov    %dl,0x18(%rcx)
        279 [1]	}
Comment 3 Dmitry Kazakov 2023-08-30 09:05:35 UTC
*** Bug 472763 has been marked as a duplicate of this bug. ***
Comment 4 Dmitry Kazakov 2023-08-30 11:27:08 UTC
Git commit a8e420bafd48e55e33d5fee89836d3d71ffb9ffb by Dmitry Kazakov.
Committed on 30/08/2023 at 12:22.
Pushed by dkazakov into branch 'krita/5.2'.

Possibly fix a crash when switching animated documents

We shouldn't delete KisPlaybackEngineQT::Private::measure on every
stop of the playback, because the timer events may be randomly
postponed and we can end up reading from a null location.

M  +22   -22   libs/ui/KisPlaybackEngineQT.cpp

https://invent.kde.org/graphics/krita/-/commit/a8e420bafd48e55e33d5fee89836d3d71ffb9ffb
Comment 5 Dmitry Kazakov 2023-08-30 11:27:52 UTC
Git commit 9bcab19c91e3b3d9d9536c769f66e595eff2e2ba by Dmitry Kazakov.
Committed on 30/08/2023 at 13:27.
Pushed by dkazakov into branch 'master'.

Possibly fix a crash when switching animated documents

We shouldn't delete KisPlaybackEngineQT::Private::measure on every
stop of the playback, because the timer events may be randomly
postponed and we can end up reading from a null location.

M  +22   -22   libs/ui/KisPlaybackEngineQT.cpp

https://invent.kde.org/graphics/krita/-/commit/9bcab19c91e3b3d9d9536c769f66e595eff2e2ba
Comment 6 Dmitry Kazakov 2023-08-30 11:29:40 UTC
Hi, Angel!

Could you please check this build when it finishes building? It should happen in about one hour. 

https://binary-factory.kde.org/job/Krita_Stable_Windows_Build/1962/

I think I have fixed the crash, though I could never reproduce it locally, so I'm not very sure.