tdf#154016: use ScopedVclPtr
A regression crash from commit d79c527c2a
(Use IconView in SmElementsControl, 2022-06-01). Without disposeAndClear,
the VirtualDevices leak; and on Windows this quickly leads to GDI handle
10 000 limit killing the process (which is good, helping to track this
kind of issues).
Change-Id: I28e1ffbeb425fae3fdbd76b7873fef5c929b8e11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150523
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -527,7 +527,7 @@ namespace
|
||||
void SmElementsControl::addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText)
|
||||
{
|
||||
std::unique_ptr<SmNode> pNode = maParser->ParseExpression(aElementVisual);
|
||||
VclPtr<VirtualDevice> pDevice(mpIconView->create_virtual_device());
|
||||
ScopedVclPtr<VirtualDevice> pDevice(mpIconView->create_virtual_device());
|
||||
pDevice->SetMapMode(MapMode(SmMapUnit()));
|
||||
pDevice->SetDrawMode(DrawModeFlags::Default);
|
||||
pDevice->SetLayoutMode(vcl::text::ComplexTextLayoutFlags::Default);
|
||||
|
||||
Reference in New Issue
Block a user