Bug 488226

Summary: Warning message when closing a document from Python API
Product: [Applications] krita Reporter: grum999
Component: ScriptingAssignee: Krita Bugs <krita-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: yavn.work
Priority: NOR    
Version First Reported In: 5.2.3-beta1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description grum999 2024-06-08 21:00:06 UTC
SUMMARY

Found something strange introduced by commit [426f99638a1fa712a6d8ded0eb9a523ef160551b](https://invent.kde.org/graphics/krita/-/commit/426f99638a1fa712a6d8ded0eb9a523ef160551b).

Execute the following script:
```python
from krita import Document

import os.path

newDoc = Krita.instance().createDocument(500, 500, "Test", "RGBA", "U8", "", 300)
newDoc.saveAs(os.path.expanduser("~/test.kra"))
newDoc.close()
```
On Krita built after this commit,  it generate the following warnings (message print 3 times):
```text
WARNING: the destination object of KisSynchronizedConnection has been destroyed during postponed delivery
WARNING: the destination object of KisSynchronizedConnection has been destroyed during postponed delivery
WARNING: the destination object of KisSynchronizedConnection has been destroyed during postponed delivery
```

Before this commit, there's no warnings.

I've tried to understand, but I'm not able to understand the relation ship with Python API here (close an opened document from UI doesn't generate warnings)

STEPS TO REPRODUCE
1. Activate log docker to get warning messages
2. Execute script in scripter


OBSERVED RESULT

Warnings message are produced

EXPECTED RESULT

No warning message

ADDITIONAL INFORMATION
Found commit with git bisect + build appimage
Comment 1 YRH 2024-10-22 21:44:00 UTC
Still reproduced in master @ 1b1422e09a9378a4c1763c41ad895eba299c7264
Observed it on Windows 11 24H2

1. Create a new document
2. Open Log View docker, enable logging
3. Open Scripter, new script, paste the script
4. Execute and the warnings will show in the log view