https://bugs.kde.org/show_bug.cgi?id=495802

            Bug ID: 495802
           Summary: Krita::documents() leaks all elements when called from
                    Python
    Classification: Applications
           Product: krita
           Version: 5.2.3
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: minor
          Priority: NOR
         Component: Scripting
          Assignee: krita-bugs-n...@kde.org
          Reporter: default_357-l...@yahoo.de
  Target Milestone: ---

***
If you're not sure this is actually a bug, instead post about it at
https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see
https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

Please remove this comment after reading and before submitting - thanks!
***

SUMMARY

The `Krita::documents()` method returns a `QList<Document*>`. When called from
a Python plugin, all the `Document*` are leaked.


STEPS TO REPRODUCE
1. Open the scripter
2. Run
```
for i in range(100000):
    docs = Krita.instance().documents()
```

OBSERVED RESULT

Heap usage rises permanently

EXPECTED RESULT

Heap usage stays stable

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 5.15.14

ADDITIONAL INFORMATION

`documents()` is defined as `QList<Document *> documents() const /Factory/;`.
But a `QList<*>` cannot track ownership. `/Factory/` just communicates that the
caller owns the `QList`, but `QList` cleanup won't (can't!) clean up the
`Document*`s. The method should probably return a
`QList<QScopedPointer<Document>>`?

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to