diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 1a8f93119d5d..767a678e20f8 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -768,9 +768,10 @@ IMPL_LINK(SmElementsDockingWindow, SelectClickHandler, SmElement&, rElement, voi if (pViewSh) { + std::unique_ptr pInsertCommand = o3tl::make_unique(SID_INSERTCOMMANDTEXT, rElement.getText()); pViewSh->GetViewFrame()->GetDispatcher()->ExecuteList( SID_INSERTCOMMANDTEXT, SfxCallMode::RECORD, - { new SfxStringItem(SID_INSERTCOMMANDTEXT, rElement.getText()) }); + { pInsertCommand.get() }); } }