Resolves: tdf#134551 ModulWindow deleted when last module removed

leaving a dangling reference to m_aName. Hold a reference until
ExecuteCommand is finished.

Change-Id: I82ac5cc73427a945c78b9317dee9edf6129bb975
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98214
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2020-07-06 16:23:51 +01:00
parent c1325c99f4
commit d299dc4540

View file

@ -1009,8 +1009,13 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
case SID_BASICIDE_DELETECURRENT:
{
if (QueryDelModule(m_aName, GetFrameWeld()))
{
// tdf#134551 don't delete the window if last module is removed until this block
// is complete
VclPtr<ModulWindow> xKeepRef(this);
if (m_aDocument.removeModule(m_aLibName, m_aName))
MarkDocumentModified(m_aDocument);
}
}
break;
case FID_SEARCH_OFF:
@ -1050,7 +1055,6 @@ void ModulWindow::ExecuteGlobal (SfxRequest& rReq)
}
}
void ModulWindow::GetState( SfxItemSet &rSet )
{
SfxWhichIter aIter(rSet);