chart2/source/controller/sidebar/ChartColorPaletteControl.cxx | 2 +- chart2/source/controller/sidebar/ChartGradientPaletteControl.cxx | 2 +- chart2/source/controller/sidebar/ChartThemeControl.cxx | 2 +- chart2/source/tools/ChartColorPalettes.cxx | 2 +- chart2/source/tools/ChartGradientPalettes.cxx | 2 +- cui/source/dialogs/screenshotannotationdlg.cxx | 2 +- cui/source/inc/cuitabarea.hxx | 2 +- cui/source/tabpages/tppattern.cxx | 8 ++++---- desktop/source/lib/init.cxx | 4 ++-- filter/source/msfilter/msdffimp.cxx | 2 +- sc/source/ui/attrdlg/scdlgfact.cxx | 2 +- sd/source/ui/dlg/sddlgfact.cxx | 2 +- sfx2/source/dialog/tabdlg.cxx | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-)
New commits: commit 8dab59fdab100682c6be9298bf534d2cb6262ec2 Author: Mike Kaganski <[email protected]> AuthorDate: Sat Feb 21 17:59:16 2026 +0500 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Feb 27 13:13:45 2026 +0100 fix assorted VirtualDevice GDI handle leaks Similar to commit e9392c0c86fcf373e00ede92f8ceeee2c7efd233 (fix VirtualDevice GDI handle leaks across IconView callers, 2026-02-21). Change-Id: Idae4f9e5fba0d5c46d32e35da5f84716616f59ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199936 Reviewed-by: Andras Timar <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200598 Reviewed-by: Caolán McNamara <[email protected]> diff --git a/chart2/source/controller/sidebar/ChartColorPaletteControl.cxx b/chart2/source/controller/sidebar/ChartColorPaletteControl.cxx index 477728f39259..f13af0259a7c 100644 --- a/chart2/source/controller/sidebar/ChartColorPaletteControl.cxx +++ b/chart2/source/controller/sidebar/ChartColorPaletteControl.cxx @@ -109,7 +109,7 @@ void ChartColorPaletteControl::updateStatus(bool bForce) if (!getToolboxId(nId, &pToolBox) && !m_pToolbar) return; - auto pDev = VclPtr<VirtualDevice>::Create(); + ScopedVclPtrInstance<VirtualDevice> pDev; renderSelectedColorPalette(pDev); auto aSelItemImg(pDev->GetBitmap(Point(), pDev->GetOutputSizePixel())); if (m_pToolbar) diff --git a/chart2/source/controller/sidebar/ChartGradientPaletteControl.cxx b/chart2/source/controller/sidebar/ChartGradientPaletteControl.cxx index 7a484f25ff75..1d3b63b2f274 100644 --- a/chart2/source/controller/sidebar/ChartGradientPaletteControl.cxx +++ b/chart2/source/controller/sidebar/ChartGradientPaletteControl.cxx @@ -105,7 +105,7 @@ void ChartGradientPaletteControl::updateStatus(bool bForce) if (!getToolboxId(nId, &pToolBox) && !m_pToolbar) return; - auto pDev = VclPtr<VirtualDevice>::Create(); + ScopedVclPtrInstance<VirtualDevice> pDev; renderSelectedGradientPalette(pDev); auto aSelItemImg(pDev->GetBitmap(Point(), pDev->GetOutputSizePixel())); if (m_pToolbar) diff --git a/chart2/source/controller/sidebar/ChartThemeControl.cxx b/chart2/source/controller/sidebar/ChartThemeControl.cxx index 2c431badef38..bebf679357bc 100644 --- a/chart2/source/controller/sidebar/ChartThemeControl.cxx +++ b/chart2/source/controller/sidebar/ChartThemeControl.cxx @@ -105,7 +105,7 @@ void ChartThemeControl::updateStatus(bool bForce) if (!getToolboxId(nId, &pToolBox) && !m_pToolbar) return; - auto pDev = VclPtr<VirtualDevice>::Create(); + ScopedVclPtrInstance<VirtualDevice> pDev; // render the actual chart into pDev auto aSelItemImg(pDev->GetBitmapEx(Point(), pDev->GetOutputSizePixel())); if (m_pToolbar) diff --git a/chart2/source/tools/ChartColorPalettes.cxx b/chart2/source/tools/ChartColorPalettes.cxx index e33d24a67cca..2b8f0436ca4b 100644 --- a/chart2/source/tools/ChartColorPalettes.cxx +++ b/chart2/source/tools/ChartColorPalettes.cxx @@ -81,7 +81,7 @@ void ChartColorPalettes::Fill() mxIconView->freeze(); - VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create(); + ScopedVclPtrInstance<VirtualDevice> pVDev; pVDev->SetOutputSizePixel(aSize); tools::Rectangle aDrawArea(0, 0, aSize.getWidth(), aSize.getHeight()); diff --git a/chart2/source/tools/ChartGradientPalettes.cxx b/chart2/source/tools/ChartGradientPalettes.cxx index b8ba1aa99546..0633e2fe2e2e 100644 --- a/chart2/source/tools/ChartGradientPalettes.cxx +++ b/chart2/source/tools/ChartGradientPalettes.cxx @@ -87,7 +87,7 @@ void ChartGradientPalettes::Fill() mxIconView->freeze(); - VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create(); + ScopedVclPtrInstance<VirtualDevice> pVDev; pVDev->SetOutputSizePixel(aSize); tools::Rectangle aDrawArea(0, 0, aSize.getWidth(), aSize.getHeight()); diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx index ffe0402e7770..3034861a9417 100644 --- a/cui/source/dialogs/screenshotannotationdlg.cxx +++ b/cui/source/dialogs/screenshotannotationdlg.cxx @@ -251,7 +251,7 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl( maPicture(this), maSaveAsText(CuiResId(RID_CUISTR_SAVE_SCREENSHOT_AS)) { - VclPtr<VirtualDevice> xParentDialogSurface(rParentDialog.screenshot()); + ScopedVclPtr<VirtualDevice> xParentDialogSurface(rParentDialog.screenshot()); maParentDialogSize = xParentDialogSurface->GetOutputSizePixel(); maParentDialogBitmap = xParentDialogSurface->GetBitmap(Point(), maParentDialogSize); maDimmedDialogBitmap = maParentDialogBitmap; diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d6dca7641d3c..aefcefd77d51 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -6579,7 +6579,7 @@ static char* getFontSubset (std::string_view aFontName) if (const vcl::Font* pFont = FindFont(aFoundFont)) { FontCharMapRef xFontCharMap (new FontCharMap()); - auto aDevice(VclPtr<VirtualDevice>::Create(DeviceFormat::WITHOUT_ALPHA)); + ScopedVclPtrInstance<VirtualDevice> aDevice(DeviceFormat::WITHOUT_ALPHA); aDevice->SetFont(*pFont); aDevice->GetFontCharMap(xFontCharMap); @@ -7289,7 +7289,7 @@ unsigned char* doc_renderFontOrientation(SAL_UNUSED_PARAMETER LibreOfficeKitDocu if (aText.isEmpty()) aText = aFont.GetFamilyName(); - auto aDevice(VclPtr<VirtualDevice>::Create(DeviceFormat::WITHOUT_ALPHA)); + ScopedVclPtrInstance<VirtualDevice> aDevice(DeviceFormat::WITHOUT_ALPHA); ::tools::Rectangle aRect; aFont.SetFontSize(Size(0, nDefaultFontSize)); aFont.SetOrientation(Degree10(pOrientation)); diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index f7aa83bbd619..9473386574c9 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4522,7 +4522,7 @@ rtl::Reference<SdrObject> SvxMSDffManager::ImportShape( const DffRecordHeader& r if ( bWithPadding ) { // trim, remove additional space - VclPtr<VirtualDevice> pDevice = VclPtr<VirtualDevice>::Create(); + ScopedVclPtrInstance<VirtualDevice> pDevice; vcl::Font aFont = pDevice->GetFont(); aFont.SetFamilyName( aFontName ); aFont.SetFontSize( Size( 0, 96 ) ); diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index d44dbee0c8f2..b4443c5b57cc 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -85,7 +85,7 @@ public: // screenshotting Bitmap createScreenshot() const override { - VclPtr<VirtualDevice> xDialogSurface(this->m_pDlg->getDialog()->screenshot()); + ScopedVclPtr<VirtualDevice> xDialogSurface(this->m_pDlg->getDialog()->screenshot()); return xDialogSurface->GetBitmap(Point(), xDialogSurface->GetOutputSizePixel()); } OUString GetScreenshotId() const override { return this->m_pDlg->get_help_id(); } diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index 2553ae906edb..b0f599e1a810 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -58,7 +58,7 @@ public: // screenshotting Bitmap createScreenshot() const override { - VclPtr<VirtualDevice> xDialogSurface(this->m_pDlg->getDialog()->screenshot()); + ScopedVclPtr<VirtualDevice> xDialogSurface(this->m_pDlg->getDialog()->screenshot()); return xDialogSurface->GetBitmap(Point(), xDialogSurface->GetOutputSizePixel()); } OUString GetScreenshotId() const override { return this->m_pDlg->get_help_id(); } diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index f4568aa08d68..b09018898f38 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -1196,7 +1196,7 @@ Bitmap SfxTabDialogController::createScreenshot() const const_cast<SfxTabDialogController*>(this)->Start_Impl(); } - VclPtr<VirtualDevice> xDialogSurface(m_xDialog->screenshot()); + ScopedVclPtr<VirtualDevice> xDialogSurface(m_xDialog->screenshot()); return xDialogSurface->GetBitmap(Point(), xDialogSurface->GetOutputSizePixel()); } commit cb496b190dd2361b0291ac6fedb5d40bd3347764 Author: Mike Kaganski <[email protected]> AuthorDate: Sat Feb 21 17:54:14 2026 +0500 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Feb 27 13:13:36 2026 +0100 fix VirtualDevice GDI handle leaks in SvxPatternTabPage Similar to commit e9392c0c86fcf373e00ede92f8ceeee2c7efd233 (fix VirtualDevice GDI handle leaks across IconView callers, 2026-02-21). Change-Id: Ib894c3f3c1a330e36b9f18aa34f98cb2adace893 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199935 Reviewed-by: Andras Timar <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200597 Reviewed-by: Caolán McNamara <[email protected]> diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 724a1854dd35..14f5a4a2b4b7 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -618,7 +618,7 @@ private: sal_Int32 SearchPatternList(std::u16string_view rPatternName); - static VclPtr<VirtualDevice> GetVirtualDevice(Bitmap aBitmap); + static ScopedVclPtr<VirtualDevice> GetVirtualDevice(Bitmap aBitmap); void FillPresetListBox(); void ShowContextMenu(const Point& pPos); void MenuSelect(const OUString& rIdent); diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx index e845fedeb927..8f0fea85886c 100644 --- a/cui/source/tabpages/tppattern.cxx +++ b/cui/source/tabpages/tppattern.cxx @@ -153,7 +153,7 @@ void SvxPatternTabPage::FillPresetListBox() OUString sId = OUString::number(nId); Bitmap aBitmap = m_pPatternList->GetBitmapForPreview(nId, aIconSize); - VclPtr<VirtualDevice> aVDev = GetVirtualDevice(aBitmap); + auto aVDev = GetVirtualDevice(aBitmap); Bitmap aBmp = aVDev->GetBitmap(Point(), aVDev->GetOutputSizePixel()); if (!m_xPatternLB->get_id(nId).isEmpty()) @@ -426,7 +426,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickAddHdl_Impl, weld::Button&, void) OUString sId = nCount > 0 ? m_xPatternLB->get_id( nCount - 1 ) : OUString(); sal_Int32 nId = !sId.isEmpty() ? sId.toInt32() : -1; Bitmap aBitmapEx = m_pPatternList->GetBitmapForPreview( nCount, aIconSize ); - VclPtr<VirtualDevice> pVDev = GetVirtualDevice(aBitmapEx); + auto pVDev = GetVirtualDevice(aBitmapEx); Bitmap aBmp = pVDev->GetBitmap(Point(), pVDev->GetOutputSizePixel()); m_xPatternLB->insert( nId + 1, &aName, &sId, &aBmp, nullptr); @@ -460,7 +460,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickModifyHdl_Impl, weld::Button&, void) m_pPatternList->Replace(std::make_unique<XBitmapEntry>(Graphic(m_xBitmapCtl->GetBitmap()), aName), nPos); Bitmap aBitmapEx = m_pPatternList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), aIconSize ); - VclPtr<VirtualDevice> pVDev = GetVirtualDevice(aBitmapEx); + auto pVDev = GetVirtualDevice(aBitmapEx); Bitmap aBmp = pVDev->GetBitmap(Point(), pVDev->GetOutputSizePixel()); m_xPatternLB->remove( nPos ); @@ -471,7 +471,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ClickModifyHdl_Impl, weld::Button&, void) m_nPatternListState |= ChangeType::MODIFIED; } -VclPtr<VirtualDevice> SvxPatternTabPage::GetVirtualDevice(Bitmap aBitmap) +ScopedVclPtr<VirtualDevice> SvxPatternTabPage::GetVirtualDevice(Bitmap aBitmap) { VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create(); const Point aNull(0, 0);
