brute force approach to stopping GTK shutdown from causing a crash as we try to manipulate no-longer-existing Objective C menu items
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6842 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
bb975dae37
commit
0bd844bd10
|
@ -37,6 +37,8 @@
|
|||
#include <ardour/audioengine.h>
|
||||
|
||||
#include <gtkmm/main.h>
|
||||
|
||||
#include <gtkmm2ext/application.h>
|
||||
#include <gtkmm2ext/popup.h>
|
||||
#include <gtkmm2ext/utils.h>
|
||||
|
||||
|
@ -394,6 +396,7 @@ int main (int argc, char* argv[])
|
|||
}
|
||||
|
||||
ui->run (text_receiver);
|
||||
Gtkmm2ext::Application::instance()->cleanup();
|
||||
ui = 0;
|
||||
|
||||
ARDOUR::cleanup ();
|
||||
|
|
|
@ -58,6 +58,12 @@ Application::ready ()
|
|||
gtk_application_ready ();
|
||||
}
|
||||
|
||||
void
|
||||
Application::cleanup ()
|
||||
{
|
||||
gtk_application_cleanup ();
|
||||
}
|
||||
|
||||
void
|
||||
Application::set_menu_bar (MenuShell& shell)
|
||||
{
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
static gint _exiting = 0;
|
||||
|
||||
static guint
|
||||
gdk_quartz_keyval_to_ns_keyval (guint keyval)
|
||||
{
|
||||
|
@ -891,9 +893,13 @@ cocoa_menu_item_accel_changed (GtkAccelGroup *accel_group,
|
|||
GClosure *accel_closure,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GNSMenuItem *cocoa_item = cocoa_menu_item_get (widget);
|
||||
GNSMenuItem *cocoa_item;
|
||||
GtkWidget *label;
|
||||
|
||||
if (_exiting)
|
||||
return;
|
||||
|
||||
cocoa_item = cocoa_menu_item_get (widget);
|
||||
get_menu_label_text (widget, &label);
|
||||
|
||||
if (GTK_IS_ACCEL_LABEL (label) &&
|
||||
|
@ -945,7 +951,12 @@ cocoa_menu_item_notify_label (GObject *object,
|
|||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GNSMenuItem *cocoa_item = cocoa_menu_item_get (GTK_WIDGET (object));
|
||||
GNSMenuItem *cocoa_item;
|
||||
|
||||
if (_exiting)
|
||||
return;
|
||||
|
||||
cocoa_item = cocoa_menu_item_get (GTK_WIDGET (object));
|
||||
|
||||
if (!strcmp (pspec->name, "label"))
|
||||
{
|
||||
|
@ -964,6 +975,9 @@ cocoa_menu_item_notify (GObject *object,
|
|||
GParamSpec *pspec,
|
||||
NSMenuItem *cocoa_item)
|
||||
{
|
||||
if (_exiting)
|
||||
return;
|
||||
|
||||
if (!strcmp (pspec->name, "sensitive") ||
|
||||
!strcmp (pspec->name, "visible"))
|
||||
{
|
||||
|
@ -1449,10 +1463,18 @@ gtk_application_ready ()
|
|||
extern "C" void
|
||||
gtk_application_cleanup()
|
||||
{
|
||||
if (_window_menu)
|
||||
_exiting = 1;
|
||||
|
||||
if (_window_menu) {
|
||||
[ _window_menu release ];
|
||||
if (_app_menu)
|
||||
_window_menu = 0;
|
||||
}
|
||||
if (_app_menu) {
|
||||
[ _app_menu release ];
|
||||
if (_main_menubar)
|
||||
_app_menu = 0;
|
||||
}
|
||||
if (_main_menubar) {
|
||||
[ _main_menubar release ];
|
||||
_main_menubar = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
~Application ();
|
||||
|
||||
void ready ();
|
||||
void cleanup ();
|
||||
void set_menu_bar (Gtk::MenuShell&);
|
||||
GtkApplicationMenuGroup* add_app_menu_group ();
|
||||
void add_app_menu_item (GtkApplicationMenuGroup*, Gtk::MenuItem*);
|
||||
|
|
Loading…
Reference in New Issue