ScopedSelectedHPEN was introduced during the implementation of smart pointers for various GDI objects [1], [2]. It uses the device context object, HDC, [3] internally with an assumption that the HDC object will be valid during the ScopedSelectedHPEN life time. This assumption was made because the entire codebase is relied on this fact. As discussed in [2] (refer to the Mike Kaganski's comments) it is better to introduce some kind of SharedHDC based on std::shared_ptr and make ScopedSelectedHPEN to use the SharedHDC instead of a raw pointer. As a result the ScopedSelectedHPEN wouldn't require to know anything about the lifetime of the device context. 1. https://bugs.documentfoundation.org/show_bug.cgi?id=107792 2. https://gerrit.libreoffice.org/#/c/65963/ 3. https://docs.microsoft.com/en-us/windows/desktop/gdi/device-contexts
This should stay unconfirmed for now, until we find a place where this would be necessary/helpful. My comment was based on poor overall knowledge of the current status of GDI code in LO. If it's actually (yet) relies on HDC being valid during the lifetime of dependent objects, then no need to implement some functionality "just in case" for a future use. Only do when the assumption is proven wrong, or is difficult to keep.
ok, let's keep it unconfirmed for the time being. I close this issue as RESOLVED WONTFIX after 6 month if it's still unconfirmed...
(In reply to Mike Kaganski from comment #1) > This should stay unconfirmed for now, until we find a place where this would > be necessary/helpful. My comment was based on poor overall knowledge of the > current status of GDI code in LO. If it's actually (yet) relies on HDC being > valid during the lifetime of dependent objects, then no need to implement > some functionality "just in case" for a future use. Only do when the > assumption is proven wrong, or is difficult to keep. Closing as RESOLVED WONTFIX after 6 months... @Dmitriy, note this issue can be moved back to UNCONFIRMED and re-evaluated at any time...