<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - Use ScopedVclPtrInstance where possible"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=107880">107880</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Use ScopedVclPtrInstance where possible
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>markus.mohrhard@googlemail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
<a href="https://cgit.freedesktop.org/libreoffice/core/tree/sw/source/core/view/viewsh.cxx?id=509c91aca5a9e89e9453082486ac7d67f649a7f5#n329">https://cgit.freedesktop.org/libreoffice/core/tree/sw/source/core/view/viewsh.cxx?id=509c91aca5a9e89e9453082486ac7d67f649a7f5#n329</a>

All the other places need to be checked if this works there as well.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>