bugGNU Octave - Bugs: bug #56155, [Mac] quit menu item disabled...


bug #56155: [Mac] quit menu item disabled after launch

Submitted by:  eflister <eflister>
Submitted on:  Wed 17 Apr 2019 05:06:11 PM UTC  
Category:  GUI Severity:  3 - Normal
Priority:  2 Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  eflister Open/Closed:  Open
Release:  dev Operating System:  Mac OS

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Tue 28 May 2019 04:07:34 AM UTC, comment #19: 

You're welcome.

Sorry, not me. I don't have the time to do a bunch of builds, and this seems to me like a pretty minor issue.

Andrew Janke <apjanke>
Tue 28 May 2019 03:40:04 AM UTC, comment #18: 

Thanks for testing.  There are clearly caveats and known issues with creating an application menu bar, and presumably there is some way to get Qt to do this.  However, resolving this probably requires someone with a whole lot of passion for this issue who is willing to do a lot of trial and error testing.

Rik <rik5>
Project Administrator
Mon 27 May 2019 11:28:14 PM UTC, comment #17: 

No change I'm afraid. The menu item is still displayed as "Quit octave-gui", and it is still disabled for me upon program launch.

Andrew Janke <apjanke>
Mon 27 May 2019 11:04:16 PM UTC, comment #16: 

@Andrew: I attached a second try that renames the menu item to "Quit" in the hopes that it picks up the native Mac shortcut.  Can you test this one too?

(file #46983)

Rik <rik5>
Project Administrator
Mon 27 May 2019 10:44:30 PM UTC, comment #15: 

Hmm. Didn't seem to work. I built the latest default on macOS 10.14.5, and the "octave-gui" > "Quit octave-gui" menu item is still greyed out and disabled for me.

Andrew Janke <apjanke>
Mon 27 May 2019 05:08:05 PM UTC, comment #14: 

It doesn't appear to impact any other platforms so I applied Pantxo's suggestion from comment #11.  Marking as "Ready for Test"

Rik <rik5>
Project Administrator
Fri 19 Apr 2019 12:10:40 AM UTC, comment #13: 

> This bug report requires someone who can build the development version of Octave for Mac

Any Mac user with Homebrew installed can build the development version pretty easily, because we (Octave.app) make our formulae public. Just do this:

brew tap octave-app/octave-app
brew install octave-default

And later, to pick up changes and update to the newest "default" development sources:

brew reinstall octave-default

With this installed, call `octave-default` to run the development octave instead of the regular released one.

If you want to test out new patches to it locally, copy the octave-default.rb formula to an "octave-default-with-<whatever_your_patches_are>.rb" and add additional "patch do" sections to it.

Note that currently, this will build against Qt 5.12, so you may have stability/freezing issues with it.

> I'm adding Andrew to the CC list in case he has time.

I'm afraid I'm in the middle of some day-job stuff right now, but may find some time tomorrow.

Andrew Janke <apjanke>
Thu 18 Apr 2019 11:54:50 PM UTC, comment #12: 

This bug report requires someone who can build the development version of Octave for Mac in order to test suggestions like the one in comment #11.  I'm adding Andrew to the CC list in case he has time.

Reading the Qt Mac OS Issues page, this also may be related/relevant

By default, Qt creates a native Quit menu item that will react to the CMD+Q shortcut. Creating a QAction for the QAction::QuitRole role will replace that menu item. Therefore, the replacement action should be connected to either the QCoreApplication::quit slot, or a custom slot that stops the application.

So, if the suggestion to use setMenuRole does not work (first choice for fix), a second possibility is to avoid creating the "Exit" option entirely on OSX platforms.  Something like

#if ! defined (OCTAVE_USE_OS_X_API)
     m_exit_action = file_menu->addAction (tr ("Exit"));
     m_exit_action->setShortcutContext (Qt::ApplicationShortcut);

Third possibility, since Qt seems to use heuristics based on text, would be to rename the "Exit" option to "Quit".  This could be done across all platforms, or just for Macs.  Something like this

#if defined (OCTAVE_USE_OS_X_API)
     m_exit_action = file_menu->addAction (tr ("Quit"));
     m_exit_action = file_menu->addAction (tr ("Exit"));
     m_exit_action->setShortcutContext (Qt::ApplicationShortcut);

In a very brief survey of applications, I found that the KDE applications seem to prefer "Quit", LibreOffice used "Exit", Thunderbird used "Quit", and Firefox used "Quit".

Rik <rik5>
Project Administrator
Thu 18 Apr 2019 07:27:37 PM UTC, comment #11: 

Or maybe something along those lines could help:

--- a/libgui/src/main-window.cc Wed Apr 17 20:35:52 2019 +0000
+++ b/libgui/src/main-window.cc Thu Apr 18 21:15:37 2019 +0200
@@ -2069,6 +2069,7 @@
     file_menu->addSeparator ();

     m_exit_action = file_menu->addAction (tr ("Exit"));
+    m_exit_action->setMenuRole (QAction::QuitRole);
     m_exit_action->setShortcutContext (Qt::ApplicationShortcut);

     connect (m_open_action, SIGNAL (triggered (void)),

The MenuRole seams to be a hint for Qt to handle native menu entries on Mac.

Pantxo Diribarne <pantxo>
Project Member
Thu 18 Apr 2019 07:45:09 AM UTC, comment #10: 

Apparently qt uses some heuristics to build the main menubar at startup. There is probably nothing we can do about that, except initializing the gui in such a way/order that qt is able to do its job properly.

Wed 17 Apr 2019 11:36:35 PM UTC, comment #9: 

That looks the same as the GNOME global application menu, and works fine here in GNOME (screen shot attached).

I don't really know whether Octave has any control over what appears in that menu, but if there's something Octave can do to make that behave better, we can certainly try to do it.

Mike Miller <mtmiller>
Project Administrator
Wed 17 Apr 2019 09:30:28 PM UTC, comment #8: 

ok attached

eflister <eflister>
Wed 17 Apr 2019 09:12:43 PM UTC, comment #7: 

Can you please send a screenshot of the menu you are referring to? There is definitely no menu entry named "quit octave-gui" in octave's main window or any dock widget.

Torsten Lilge <ttl>
Project Member
Wed 17 Apr 2019 07:15:54 PM UTC, comment #6: 

I am neither pretending that the issue you are seeing is correct behavior, nor am I looking for a workaround. I just want to make sure where the problem exactly occurs. A fix of the internal "File/Exit" menu would be completely different from a fix of the window manager's menu.

And yes, closing the main window exits the related application on my system.

Torsten Lilge <ttl>
Project Member
Wed 17 Apr 2019 06:16:40 PM UTC, comment #5: 

@rik5: i had done #2 and found no consistent pattern, as stated.  i don't feel #1 is likely enough to warrant investigation, but someone with knowledge of the inner workings might.

@ttl: i'm not talking about closing windows, but the whole app.  i don't think you're arguing that the current disabling of the menu item is correct behavior?  i'm not in need of a workaround, i can type exit/quit in the command window.

eflister <eflister>
Wed 17 Apr 2019 05:44:52 PM UTC, comment #4: 

I guess you refer to the window manager's menu that is available for every window. On Gnome this menu is involed by Alt+Space and offers the possibility to "Close" the window.

In my case (Debian + Gnome), this reliably exits octave.

Torsten Lilge <ttl>
Project Member
Wed 17 Apr 2019 05:35:25 PM UTC, comment #3: 

Must be equivalent to File->Exit on Linux.

Obvious first thoughts are that it is linked either 1) a timeout or 2) an action sequence.

To test #2, can you launch Octave and then execute a simple command like

x = 1

and then check the to see if the menu item is enabled?

If that doesn't work, try a more complicated command like


For test #1, launch Octave and then wait for specified lengths of time (15 seconds, 30 seconds, 1 minute) and check whether the Quit item has been enabled.

Rik <rik5>
Project Administrator
Wed 17 Apr 2019 05:17:17 PM UTC, comment #2: 

under octave-gui menu on osx, "quit octave-gui"

eflister <eflister>
Wed 17 Apr 2019 05:12:14 PM UTC, comment #1: 

Which menu item are you referring to?  On Linux there is no menu item labeled "Quit".  For the main application there is File->Exit.  If you have created a plot window then the figure window has a File->Close item.

Rik <rik5>
Project Administrator
Wed 17 Apr 2019 05:06:11 PM UTC, original submission:  

can't quit from the menu immediately after launch.  at some point it enables, but it's not reliable.  on one test, it enabled after resizing a window, but now that isn't working.

eflister <eflister>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #46983:  bug56155.diff added by rik5 (535B - text/x-patch)
file #46792:  gnome-app-menu.png added by mtmiller (23KiB - image/png)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by apjanke (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by eflister (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-05-28 rik5 Priority5 - Normal => 2
        StatusPatch Submitted => Confirmed
    2019-05-27 rik5 Attached File- => Added bug56155.diff, #46983
        StatusReady For Test => Patch Submitted
    2019-05-27 rik5 StatusNeed Info => Ready For Test
        Release5.1.0 => dev
    2019-04-18 rik5 Carbon-Copy- => Added apjanke
    2019-04-17 mtmiller Attached File- => Added gnome-app-menu.png, #46792
    2019-04-17 eflister Attached File- => Added Screen Shot 2019-04-17 at 2.28.41 PM.png, #46791
    2019-04-17 rik5 Summaryquit menu item disabled after launch => [Mac] quit menu item disabled after launch
    2019-04-17 rik5 StatusNone => Need Info

    Back to the top

    Powered by Savane 3.5