[Libreoffice-bugs] [Bug 107880] New: Use ScopedVclPtrInstance where possible

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Mon May 15 21:38:43 UTC 2017


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: libreoffice-bugs at lists.freedesktop.org
          Reporter: markus.mohrhard at googlemail.com

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20170515/05babc37/attachment.html>


More information about the Libreoffice-bugs mailing list