commit ab81c23656b59aa14c41b8acc45f0f3e410ed785
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Wed Jul 5 12:28:26 2017 +0200

    Do not use toobar menu as fallback context menu
    
    This is a consequence of e91572a0, although it is not clear why. The
    contextMenuEvent code of the workarea should not delegate context
    menu when it cannot honor it.
    
    Also fix a small memory leak.
    
    Fixes bug #10616.
---
 src/frontends/qt4/GuiView.cpp     |    3 +--
 src/frontends/qt4/GuiWorkArea.cpp |    4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index 7b71897..5ff15c8 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -3440,8 +3440,7 @@ bool GuiView::goToFileRow(string const & argument)
 
 void GuiView::toolBarPopup(const QPoint & /*pos*/)
 {
-       QMenu * menu = new QMenu;
-       menu = guiApp->menus().menu(toqstr("context-toolbars"), * this);
+       QMenu * menu = guiApp->menus().menu(toqstr("context-toolbars"), * this);
        menu->exec(QCursor::pos());
 }
 
diff --git a/src/frontends/qt4/GuiWorkArea.cpp 
b/src/frontends/qt4/GuiWorkArea.cpp
index 5810e68..7b46eee 100644
--- a/src/frontends/qt4/GuiWorkArea.cpp
+++ b/src/frontends/qt4/GuiWorkArea.cpp
@@ -777,7 +777,7 @@ void GuiWorkArea::contextMenuEvent(QContextMenuEvent * e)
        }
 
        if (name.empty()) {
-               QAbstractScrollArea::contextMenuEvent(e);
+               e->accept();
                return;
        }
        // always show mnemonics when the keyboard is used to show the context 
menu
@@ -785,7 +785,7 @@ void GuiWorkArea::contextMenuEvent(QContextMenuEvent * e)
        bool const keyboard = (e->reason() == QContextMenuEvent::Keyboard);
        QMenu * menu = guiApp->menus().menu(toqstr(name), *d->lyx_view_, 
keyboard);
        if (!menu) {
-               QAbstractScrollArea::contextMenuEvent(e);
+               e->accept();
                return;
        }
        // Position the menu to the right.

Reply via email to