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<SfxAbstractTabDialog>::~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 <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2026-10-07 17:48:12 +02:00
parent e2c6a76dfe
commit 1ad0ba1af4
+2 -5
View File
@@ -83,7 +83,6 @@ void FuTransform::DoExecute( SfxRequest& rReq )
SfxItemSet aSet( mpView->GetGeoAttrFromMarked() );
VclPtr<SfxAbstractTabDialog> 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<SfxRequest>(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();
});
}