Summary: | Document::clone() can trigger an assert | ||
---|---|---|---|
Product: | [Applications] krita | Reporter: | Zlatko Masek <zlatko.masek> |
Component: | Scripting | Assignee: | Krita Bugs <krita-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | anna.medonosova, halla |
Priority: | NOR | ||
Version: | 4.1.0 | ||
Target Milestone: | --- | ||
Platform: | Microsoft Windows | ||
OS: | Microsoft Windows | ||
Latest Commit: | https://invent.kde.org/graphics/krita/commit/c43fa1a7f78afad41d74f4c039bdac704ddcb582 | Version Fixed In: | |
Sentry Crash Report: | |||
Attachments: |
backtrace
Python script triggering the issue Python script that does not trigger the issue |
Description
Zlatko Masek
2018-11-28 10:33:50 UTC
I am sorry, I cannot reproduce your issue. I tested in Krita 4.1.0 and 4.1.5 Portable 64-bit on Windows 10 with following code run in Scripter: --------------------------------------------- document = Krita.instance().activeDocument() new_image = document.clone() print(new_image.fileName()) --------------------------------------------- I assume that by “Krita turns off by itself” you mean it crashes. Could you please provide a backtrace from the crash? You can find instruction on how to do that at: https://docs.krita.org/en/reference_manual/dr_minw_debugger.html Could you also please provide a complete script that triggers the issue on your setup? Hi, Anna, No crash report as far as I can see. It doesn't give the crash dialog at all. I pushed the code to the repo so you can inspect: https://bitbucket.org/zmasek/krita-leaflet/src/master/ The code is still in development, but the line that breaks it is in app.py on line 56. Thanks Thanks for your comment! Automatically switching the status of this bug to REPORTED so that the KDE team knows that the bug is ready to get confirmed. In the future you may also do this yourself when providing needed information. Thanks for supplying the whole plugin. I have run it and I can confirm the issue, it is present also on linux in git master. The python code triggers the following assert: ASSERT (krita): "!rhs.m_d->projectionUpdatesFilter" in file [..]/src/master/libs/image/kis_image.cc, line 340 How it happens: 1, the plug-in assigns the active document to self.document 2, then it runs self.document.scaleImage() and self.document.crop() 3, while operations from 2 are still running, the plug-in attempts to clone the document with self.document.clone() 4, assert is triggered I attach a simple script (401497_test.py) based on the plug-in code that reproduces the issue, to simplify testing. If I call Document::waitForDone() after scaleImage() and crop() calls, the assert is not triggered (demonstrated by 401497_test_nocrash.py). Created attachment 116663 [details]
backtrace
Created attachment 116664 [details]
Python script triggering the issue
Created attachment 116665 [details]
Python script that does not trigger the issue
I guess that since the python api is supposed to be synchronous, it's easiest to just add waitForDone in the Document methods where appropriate. Git commit 0fa80e364094483bbf3197ed219054609ac38259 by Boudewijn Rempt. Committed on 19/05/2020 at 09:47. Pushed by rempt into branch 'master'. Call waitForDone after starting a background job from a script And copy the relevant documentation for locking/waiting methods from KisImage. (cherry picked from commit c43fa1a7f78afad41d74f4c039bdac704ddcb582) M +6 -6 libs/libkis/Document.cpp M +29 -14 libs/libkis/Document.h M +0 -1 plugins/extensions/pykrita/sip/krita/Document.sip https://invent.kde.org/graphics/krita/commit/0fa80e364094483bbf3197ed219054609ac38259 Git commit c43fa1a7f78afad41d74f4c039bdac704ddcb582 by Boudewijn Rempt. Committed on 19/05/2020 at 09:47. Pushed by rempt into branch 'krita/4.3'. Call waitForDone after starting a background job from a script And copy the relevant documentation for locking/waiting methods from KisImage. M +6 -6 libs/libkis/Document.cpp M +29 -14 libs/libkis/Document.h M +0 -1 plugins/extensions/pykrita/sip/krita/Document.sip https://invent.kde.org/graphics/krita/commit/c43fa1a7f78afad41d74f4c039bdac704ddcb582 |