[Konsole-devel] [konsole] [Bug 357286] New: [OS X] KActionMenu items can only be added to 1 menu at a time (or else generate errors and can cause crashes)

RJVB via KDE Bugzilla bugzilla_noreply at kde.org
Mon Dec 28 22:16:10 UTC 2015


https://bugs.kde.org/show_bug.cgi?id=357286

            Bug ID: 357286
           Summary: [OS X] KActionMenu items can only be added to 1 menu
                    at a time (or else generate errors and can cause
                    crashes)
           Product: konsole
           Version: master
          Platform: Compiled Sources
                OS: OS X
            Status: UNCONFIRMED
          Severity: crash
          Priority: NOR
         Component: general
          Assignee: konsole-devel at kde.org
          Reporter: rjvbertin at gmail.com

KF5's KActionMenu which is based on QWidgetAction can, to my understanding,
only be added to a single menu at a time on OS X. Adding it to multiple menus
leads to repeated errors being printed:

```
void QCocoaMenu::insertNative(QCocoaMenuItem *, QCocoaMenuItem *) Menu item
"Set &Encoding" is already in menu "View" , remove it from the other menu first
before inserting into "Untitled"
void QCocoaMenu::insertNative(QCocoaMenuItem *, QCocoaMenuItem *) Menu item
"Switch Profile" is already in menu "Settings" , remove it from the other menu
first before inserting into "Untitled"
void QCocoaMenu::insertNative(QCocoaMenuItem *, QCocoaMenuItem *) Menu item
"Set &Encoding" is already in menu "View" after item "" , remove it from the
other menu first before inserting into "View"
void QCocoaMenu::insertNative(QCocoaMenuItem *, QCocoaMenuItem *) Menu item
"Switch Profile" is already in menu "Settings" after item "Manage Profiles..."
, remove it from the other menu first before inserting into "Settings"
void QCocoaMenu::insertNative(QCocoaMenuItem *, QCocoaMenuItem *) Menu item
"Set &Encoding" is already in menu "View" after item "" , remove it from the
other menu first before inserting into "View"
void QCocoaMenu::insertNative(QCocoaMenuItem *, QCocoaMenuItem *) Menu item
"Switch Profile" is already in menu "Settings" after item "Manage Profiles..."
, remove it from the other menu first before inserting into "Settings"
```

(the errors are more informative thanks to a local patch)

and can apparently also lead to crashing (here on exit):

```
Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000007fe6884d0ba

VM Regions Near 0x7fe6884d0ba:
    CG backing stores      00000001cba61000-00000001cba8b000 [  168K] rw-/rw-
SM=SHM  
--> 
    MALLOC_TINY            00007fe688400000-00007fe688600000 [ 2048K] rw-/rwx
SM=PRV  

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   org.qt-project.QtCore             0x000000010402a814 QObject::property(char
const*) const + 36 (qobject.cpp:3876)
1   libqcocoa.dylib                   0x0000000108c9e31a
QCocoaMenuItem::~QCocoaMenuItem() + 58 (qcocoamenuitem.mm:109)
2   libqcocoa.dylib                   0x0000000108c9e4ce
QCocoaMenuItem::~QCocoaMenuItem() + 14 (qcocoamenuitem.mm:106)
3   org.qt-project.QtWidgets          0x000000010309b9bd
QMenu::actionEvent(QActionEvent*) + 749 (qmenu.cpp:3224)
4   org.qt-project.QtWidgets          0x0000000102f673d0
QWidget::event(QEvent*) + 1232 (qwidget.cpp:9044)
5   org.qt-project.QtWidgets          0x0000000103099bdc QMenu::event(QEvent*)
+ 1164 (qmenu.cpp:2678)
6   org.qt-project.QtWidgets          0x0000000102f2953b
QApplicationPrivate::notify_helper(QObject*, QEvent*) + 251
(qapplication.cpp:3716)
7   org.qt-project.QtWidgets          0x0000000102f2c8f4
QApplication::notify(QObject*, QEvent*) + 8212 (qapplication.cpp:3681)
8   org.qt-project.QtCore             0x0000000103ff9433
QCoreApplication::notifyInternal(QObject*, QEvent*) + 115 (qthread_p.h:291)
9   org.qt-project.QtWidgets          0x0000000102f5b2ed
QWidget::removeAction(QAction*) + 125 (qcoreapplication.h:224)
10  org.qt-project.QtWidgets          0x0000000102f1f711 QAction::~QAction() +
97 (qaction.cpp:566)
11  org.qt-project.QtWidgets          0x0000000102f7016c
QWidgetAction::~QWidgetAction() + 444 (qwidgetaction.cpp:122)
12  libKF5WidgetsAddons.5.dylib       0x0000000102cbf353
KActionMenu::~KActionMenu() + 67 (kactionmenu.cpp:77)
13  org.qt-project.QtCore             0x0000000104021d75
QObjectPrivate::deleteChildren() + 245 (qobject.cpp:1943)
14  org.qt-project.QtCore             0x0000000104021b40 QObject::~QObject() +
1792 (qobject.cpp:1027)
15  libkonsoleprivate.15.dylib        0x00000001017d13c8
Konsole::ViewProperties::~ViewProperties() + 104 (ViewProperties.cpp:37)
16  libkonsoleprivate.15.dylib        0x00000001017a1f16
Konsole::SessionController::~SessionController() + 614
(SessionController.cpp:218)
17  libkonsoleprivate.15.dylib        0x00000001017a1f5e
Konsole::SessionController::~SessionController() + 14
(SessionController.cpp:209)
18  org.qt-project.QtCore             0x0000000104021d75
QObjectPrivate::deleteChildren() + 245 (qobject.cpp:1943)
19  org.qt-project.QtCore             0x0000000104021b40 QObject::~QObject() +
1792 (qobject.cpp:1027)
20  libkonsoleprivate.15.dylib        0x00000001017ca788
Konsole::ViewManager::~ViewManager() + 200 (ViewManager.cpp:103)
21  libkonsoleprivate.15.dylib        0x00000001017ca7ae
Konsole::ViewManager::~ViewManager() + 14 (ViewManager.cpp:102)
22  org.qt-project.QtCore             0x0000000104021d75
QObjectPrivate::deleteChildren() + 245 (qobject.cpp:1943)
23  org.qt-project.QtWidgets          0x0000000102f56ee1 QWidget::~QWidget() +
1441 (qwidget.cpp:1658)
24  libKF5XmlGui.5.dylib              0x000000010200471a
KMainWindow::~KMainWindow() + 218 (kmainwindow.cpp:362)
25  libkdeinit5_konsole.dylib         0x00000001016fb41b
Konsole::MainWindow::~MainWindow() + 107 (MainWindow.h:57)
26  org.qt-project.QtCore             0x0000000104022748
QObject::event(QEvent*) + 776 (qobject.cpp:4455)
27  org.qt-project.QtWidgets          0x0000000102f67d26
QWidget::event(QEvent*) + 3622 (qwidget.cpp:9105)
28  org.qt-project.QtWidgets          0x000000010306f45f
QMainWindow::event(QEvent*) + 911 (qmainwindow.cpp:1495)
29  libKF5XmlGui.5.dylib              0x0000000102006810
KMainWindow::event(QEvent*) + 624 (kmainwindow.cpp:829)
30  libKF5XmlGui.5.dylib              0x000000010203e398
KXmlGuiWindow::event(QEvent*) + 24 (kxmlguiwindow.cpp:118)
31  org.qt-project.QtWidgets          0x0000000102f2953b
QApplicationPrivate::notify_helper(QObject*, QEvent*) + 251
(qapplication.cpp:3716)
32  org.qt-project.QtWidgets          0x0000000102f2c8f4
QApplication::notify(QObject*, QEvent*) + 8212 (qapplication.cpp:3681)
33  org.qt-project.QtCore             0x0000000103ffa0db
QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 971
(qthread_p.h:291)
34  org.qt-project.QtCore             0x0000000103ff9a2c
QCoreApplication::exec() + 412 (qcoreapplication.cpp:1240)
35  libkdeinit5_konsole.dylib         0x00000001016e893f kdemain + 4143
(main.cpp:125)
36  libdyld.dylib                     0x00007fff8e8b05fd start + 1
```

Reproducible: Always

Steps to Reproduce:
1. start konsole5 from a terminal, e.g.
`/path/to/konsole.app/Contents/MacOS/konsole` (kate5 is similarly affected)
2. observe the errors being printed
3. quit using the menu

Actual Results:  
An "in-window" menubar is shown IN ADDITION TO a Mac-style toplevel menubar.
Errors are printed each time an attempt is made to (re)generate the menu. The
application crashes on exit most of the time but not always (notably not when
typing `exit` in the last active shell).

Expected Results:  
No error messages and no crashing. And either a toplevel, Mac-style menubar or
one in the window, not both.

I would love to know why a global menubar is shown too, and where the choice is
made what items from the KActionCollection() are added to the context menu
instead of only to the menubar.

I would propose to add both the "Switch Profile" and the "Set Encoding" actions
to the context menu only.

NB: the "Edit Current Profile" action is not affected, which supports the
notion that only objects derived from QWidgetAction are concerned by this
issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the konsole-devel mailing list