--- Comment #2 from Kowther Hassan <kowth...@gmail.com> ---
(In reply to Markus Mohrhard from comment #0)
> Currently we manually keep track of the lifecycle of GDI resources and
> delete them manually. Instead we should use a reference counted object that
> releases the handle as soon as we don't need it any more.
> Tomasz already introduced such a concept to fix one of our GDI handle leaks
> That commit introduces a scoped version and we need additionally a reference
> counted version. These correspond to scoped_ptr and shared_ptr in C++.
Hi I am an undergraduate student new to open source development and Libre
Office and an intermediate knowledge of C++ (I applied for GSoC). I want to
tackle this bug but have a few questions. I have not used shared_ptr,
scoped_ptr or anything to do with reference counting before.
- The example mentioned introduced the class ScopedHDC that deletes the object
for you.Is this fix just for HDC objects? Or are there other gdi objects? I am
not familiar with gdi. I see other objects such as HBITMAP, HBRUSH, HFONT that
are all manually destroyed using DeleteObject().
- Is this fix asking for an alternative to ScopedHDC class using shared
pointers or scoped pointers?
- For shared_ptr, my understanding is that you could create a shared_ptr object
std::shared_ptr<HDC> hNewDC = std::make_shared<HDC>( CreateCompatibleDC(hDC) );
then use it as you would a regular pointer without having to call
DeleteDC(hNewDC) once your done. Is my understanding correct?
You are receiving this mail because:
You are the assignee for the bug.
Libreoffice-bugs mailing list