From 1ad0ba1af4c278afcb4db029d518a58a6d3c4bc1 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 6 Oct 2026 10:36:41 +0200 Subject: [PATCH] sd: Dispose AbstractSvxCaptionDialog Without this in place, the following assert would be triggered when closing the dialog: soffice.bin: /home/michi/development/git/libreoffice/include/vcl/vclptr.hxx:134: VclPtr::~VclPtr() [reference_type = SfxAbstractTabDialog]: Assertion `(!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1) && "someone forgot to call dispose()"' failed. Steps to reproduce: * start Draw * make sure the "Text" toolbar is enabled in "View" -> "Toolbars" -> "Text" * in that "Text" toolbar, select the "Callouts" shape and insert it into the document * right-click on the newly inserted shape to open the context menu * activate the "Position and Size" menu entry to open the dialog * press the "OK" button to close the dialog again Change-Id: I2ddf9b6b0997db091ff8bc320ae04fbbfee19415 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211879 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- sd/source/ui/func/futransf.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx index 0cacbe32c0b2..a3c41f9692bc 100644 --- a/sd/source/ui/func/futransf.cxx +++ b/sd/source/ui/func/futransf.cxx @@ -83,7 +83,6 @@ void FuTransform::DoExecute( SfxRequest& rReq ) SfxItemSet aSet( mpView->GetGeoAttrFromMarked() ); VclPtr pDlg; - bool bWelded = false; SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); if( rMarkList.GetMarkCount() == 1 && pObj->GetObjInventor() == SdrInventor::Default && @@ -105,7 +104,6 @@ void FuTransform::DoExecute( SfxRequest& rReq ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); pDlg.reset(pFact->CreateSvxTransformTabDialog(mrViewShell.GetFrameWeld(), &aSet, mpView)); - bWelded = true; } assert(pDlg && "there must be a dialog at this point"); @@ -113,7 +111,7 @@ void FuTransform::DoExecute( SfxRequest& rReq ) auto xRequest = std::make_shared(rReq); rReq.Ignore(); // the 'old' request is not relevant any more - pDlg->StartExecuteAsync([bWelded, pDlg, xRequest=std::move(xRequest), this](sal_Int32 nResult){ + pDlg->StartExecuteAsync([pDlg, xRequest=std::move(xRequest), this](sal_Int32 nResult){ if (nResult == RET_OK) { xRequest->Done(*(pDlg->GetOutputItemSet())); @@ -124,8 +122,7 @@ void FuTransform::DoExecute( SfxRequest& rReq ) // deferred until the dialog ends mrViewShell.Invalidate(SID_RULER_OBJECT); mrViewShell.Cancel(); - if (bWelded) - pDlg->disposeOnce(); + pDlg->disposeOnce(); }); }