mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Work around a bug with crash on view close on Mac OSX.
See also https://bugreports.qt-project.org/browse/QTBUG-25399 It improves the situation with LyX ticket #8063 and fixes #8062 for Cocoa builds
This commit is contained in:
parent
bf67e60f3a
commit
5a5d6a524c
@ -1033,7 +1033,14 @@ bool GuiApplication::getStatus(FuncRequest const & cmd, FuncStatus & flag) const
|
|||||||
case LFUN_SERVER_NOTIFY:
|
case LFUN_SERVER_NOTIFY:
|
||||||
enable = true;
|
enable = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_DIALOG_SHOW: {
|
||||||
|
string const name = cmd.getArg(0);
|
||||||
|
if (name == "aboutlyx" || name == "prefs") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1634,6 +1641,15 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
|||||||
lyxerr.setLevel(Debug::value(to_utf8(cmd.argument())));
|
lyxerr.setLevel(Debug::value(to_utf8(cmd.argument())));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LFUN_DIALOG_SHOW: {
|
||||||
|
string const name = cmd.getArg(0);
|
||||||
|
|
||||||
|
if ( name == "aboutlyx" || name == "prefs") {
|
||||||
|
if (current_view_ == 0)
|
||||||
|
createView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// The LFUN must be for one of GuiView, BufferView, Buffer or Cursor;
|
// The LFUN must be for one of GuiView, BufferView, Buffer or Cursor;
|
||||||
// let's try that:
|
// let's try that:
|
||||||
|
@ -424,9 +424,14 @@ GuiView::GuiView(int id)
|
|||||||
// filling, at least for the static special menu item on Mac. Otherwise
|
// filling, at least for the static special menu item on Mac. Otherwise
|
||||||
// they are greyed out.
|
// they are greyed out.
|
||||||
guiApp->setCurrentView(this);
|
guiApp->setCurrentView(this);
|
||||||
|
|
||||||
// Fill up the menu bar.
|
#if defined(Q_WS_MACX)
|
||||||
guiApp->menus().fillMenuBar(menuBar(), this, true);
|
static QMenuBar * qmb = new QMenuBar(0);
|
||||||
|
#else
|
||||||
|
QMenuBar * qmb = menuBar();
|
||||||
|
#endif
|
||||||
|
// Fill up the menu bar.
|
||||||
|
guiApp->menus().fillMenuBar(qmb, this, true);
|
||||||
|
|
||||||
setCentralWidget(d.stack_widget_);
|
setCentralWidget(d.stack_widget_);
|
||||||
|
|
||||||
|
@ -1724,7 +1724,7 @@ void Menus::Impl::macxMenuBarInit(GuiView * view, QMenuBar * qmb)
|
|||||||
QAction::MenuRole role;
|
QAction::MenuRole role;
|
||||||
};
|
};
|
||||||
|
|
||||||
MacMenuEntry entries[] = {
|
static MacMenuEntry entries[] = {
|
||||||
{LFUN_DIALOG_SHOW, "aboutlyx", "About LyX",
|
{LFUN_DIALOG_SHOW, "aboutlyx", "About LyX",
|
||||||
QAction::AboutRole},
|
QAction::AboutRole},
|
||||||
{LFUN_DIALOG_SHOW, "prefs", "Preferences",
|
{LFUN_DIALOG_SHOW, "prefs", "Preferences",
|
||||||
@ -1743,18 +1743,18 @@ void Menus::Impl::macxMenuBarInit(GuiView * view, QMenuBar * qmb)
|
|||||||
mac_special_menu_.add(MenuItem(MenuItem::Command,
|
mac_special_menu_.add(MenuItem(MenuItem::Command,
|
||||||
entries[i].label, func));
|
entries[i].label, func));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// add the entries to a QMenu that will eventually be empty
|
||||||
// add the entries to a QMenu that will eventually be empty
|
// and therefore invisible.
|
||||||
// and therefore invisible.
|
QMenu * qMenu = qmb->addMenu("special");
|
||||||
QMenu * qMenu = qmb->addMenu("special");
|
MenuDefinition::const_iterator cit = mac_special_menu_.begin();
|
||||||
MenuDefinition::const_iterator cit = mac_special_menu_.begin();
|
MenuDefinition::const_iterator end = mac_special_menu_.end();
|
||||||
MenuDefinition::const_iterator end = mac_special_menu_.end();
|
for (size_t i = 0 ; cit != end ; ++cit, ++i) {
|
||||||
for (size_t i = 0 ; cit != end ; ++cit, ++i) {
|
Action * action = new Action(view, QIcon(), cit->label(),
|
||||||
Action * action = new Action(view, QIcon(), cit->label(),
|
cit->func(), QString(), qMenu);
|
||||||
cit->func(), QString(), qMenu);
|
action->setMenuRole(entries[i].role);
|
||||||
action->setMenuRole(entries[i].role);
|
qMenu->addAction(action);
|
||||||
qMenu->addAction(action);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user