https://bugs.documentfoundation.org/show_bug.cgi?id=107880

            Bug ID: 107880
           Summary: Use ScopedVclPtrInstance where possible
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: [email protected]
          Reporter: [email protected]

Currently we have many methods that do an explicit:

VclPtr<VirtualDevice> aDev = VclPtr<VirtualDevice>::Create(...);
....
aDev.disposeAndClear();


This construct is not exception safe and can easily introduce GDI leaks with
new return paths. For these cases we actually have ScopedVclPtrInstance which
automatically calls dispose when the object out of scope.

This task is about going through the list returned by git grep
VclPtr<VirtualDevice>::Create and transform the ones that call the
disposeAndClear inside of the same method to a ScopedVclPtrInstance.

An example that shows where this can be done is
https://cgit.freedesktop.org/libreoffice/core/tree/sw/source/core/view/viewsh.cxx?id=509c91aca5a9e89e9453082486ac7d67f649a7f5#n329

All the other places need to be checked if this works there as well.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to