Resolves: tdf#146342 spelling menu doesn't appear

the XPopupMenu from CreateMenuInterface owns the vcl menu after it's
created.

Change-Id: I0959b3359a4683ce8ca50912136f829b8bbee859
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128063
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 32c8584..5b765f4 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5405,7 +5405,8 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
                        aEvent.ExecutePosition.X = aPixPos.X();
                        aEvent.ExecutePosition.Y = aPixPos.Y();
                        css::uno::Reference<css::awt::XPopupMenu> xMenu;
                        if (GetView().TryContextMenuInterception(aROPopup.CreateMenuInterface(), "private:resource/ReadonlyContextMenu", xMenu, aEvent))
                        auto xMenuInterface = aROPopup.CreateMenuInterface();
                        if (GetView().TryContextMenuInterception(xMenuInterface, "private:resource/ReadonlyContextMenu", xMenu, aEvent))
                        {
                            if (xMenu.is())
                            {
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index adb1621..2c34913 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -713,7 +713,8 @@ bool SwView::ExecSpellPopup(const Point& rPt)

                OUString sMenuName = bUseGrammarContext ?
                    OUString("private:resource/GrammarContextMenu") : OUString("private:resource/SpellContextMenu");
                if (TryContextMenuInterception(xPopup->CreateMenuInterface(), sMenuName, xMenu, aEvent))
                auto xMenuInterface = xPopup->CreateMenuInterface();
                if (TryContextMenuInterception(xMenuInterface, sMenuName, xMenu, aEvent))
                {
                    //! happy hacking for context menu modifying extensions of this
                    //! 'custom made' menu... *sigh* (code copied from sfx2 and framework)