From 27c5844448558686b12153ce04e4904d17afa514 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 3 Jul 2009 21:21:30 +0000 Subject: do not attempt to use scroll view for AU plugin GUIs (fixes crash-on-delete of Cocoa-based AU plugins) ; drop references in PlugUIBase to plugin/insert when it notifies us via GoingAway (fixes crash on session close) ; fix handling of AU cache info for certain plugins ; fix SConstruct missing lrdf, raptor, samplerate library definitions (\!\!\!) git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5310 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui.cc | 4 +++- gtk2_ardour/au_pluginui.h | 1 - gtk2_ardour/au_pluginui.mm | 49 +++++++++------------------------------------- gtk2_ardour/plugin_ui.cc | 11 ++++++++++- gtk2_ardour/plugin_ui.h | 2 ++ 5 files changed, 24 insertions(+), 43 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 841d74f0b2..726873dffc 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2408,7 +2408,9 @@ ARDOUR_UI::close_session () return; } - unload_session (true); + if (unload_session (true)) { + return; + } get_session_parameters (true, false); } diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index 2f7e5a1f90..481378e413 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -69,7 +69,6 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox /* Cocoa */ NSWindow* cocoa_window; - NSScrollView* scroll_view; NSView* au_view; /* Carbon */ diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm index 205364b343..1d7029365a 100644 --- a/gtk2_ardour/au_pluginui.mm +++ b/gtk2_ardour/au_pluginui.mm @@ -130,8 +130,12 @@ AUPluginUI::~AUPluginUI () DisposeWindow (carbon_window); } - if (packView && packView != au_view) { - [packView release]; + if (packView) { + /* remove whatever we packed into low_box so that GTK doesn't + mess with it. + */ + + [packView removeFromSuperview]; } } @@ -285,46 +289,12 @@ AUPluginUI::create_cocoa_view () [(AUGenericView *)au_view setShowsExpertParameters:YES]; } - NSRect packFrame; + packView = au_view; // Get the size of the new AU View's frame + + NSRect packFrame; packFrame = [au_view frame]; - - packFrame.origin.x = 0; - packFrame.origin.y = 0; - - if (packFrame.size.width > 500 || packFrame.size.height > 500) { - - /* its too big - use a scrollview */ - - NSRect frameRect = [[cocoa_window contentView] frame]; - scroll_view = [[[NSScrollView alloc] initWithFrame:frameRect] autorelease]; - [scroll_view setDrawsBackground:NO]; - [scroll_view setHasHorizontalScroller:YES]; - [scroll_view setHasVerticalScroller:YES]; - - packFrame.size = [NSScrollView frameSizeForContentSize:packFrame.size - hasHorizontalScroller:[scroll_view hasHorizontalScroller] - hasVerticalScroller:[scroll_view hasVerticalScroller] - borderType:[scroll_view borderType]]; - - // Create a new frame with same origin as current - // frame but size equal to the size of the new view - NSRect newFrame; - newFrame.origin = [scroll_view frame].origin; - newFrame.size = packFrame.size; - - // Set the new frame and document views on the scroll view - [scroll_view setFrame:newFrame]; - [scroll_view setDocumentView:au_view]; - - packView = scroll_view; - - } else { - - packView = au_view; - } - prefwidth = packFrame.size.width; prefheight = packFrame.size.height; @@ -552,7 +522,6 @@ AUPluginUI::parent_cocoa_window () packFrame = [au_view frame]; NSView* view = gdk_quartz_window_get_nsview (low_box.get_window()->gobj()); - [view setFrame:packFrame]; [view addSubview:packView]; diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc index 8c32028d71..0705d22a8b 100644 --- a/gtk2_ardour/plugin_ui.cc +++ b/gtk2_ardour/plugin_ui.cc @@ -322,7 +322,6 @@ PluginUIWindow::plugin_going_away () } death_connection.disconnect (); - delete_when_idle (this); } @@ -361,12 +360,22 @@ PlugUIBase::PlugUIBase (boost::shared_ptr pi) ARDOUR_UI::instance()->set_tip (&focus_button, _("Click to allow the plugin to receive keyboard events that Ardour would normally use as a shortcut"), ""); ARDOUR_UI::instance()->set_tip (&bypass_button, _("Click to enable/disable this plugin"), ""); + + insert->GoingAway.connect (mem_fun (*this, &PlugUIBase::plugin_going_away)); } PlugUIBase::~PlugUIBase () { } +void +PlugUIBase::plugin_going_away () +{ + /* drop references to the plugin/insert */ + insert.reset (); + plugin.reset (); +} + void PlugUIBase::redirect_active_changed (Redirect* r, void* src) { diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h index 4c14224a58..3e027b620e 100644 --- a/gtk2_ardour/plugin_ui.h +++ b/gtk2_ardour/plugin_ui.h @@ -99,6 +99,8 @@ class PlugUIBase : public virtual sigc::trackable bool focus_toggled(GdkEventButton*); void bypass_toggled(); void redirect_active_changed (ARDOUR::Redirect* r, void* src); + + void plugin_going_away (); }; class GenericPluginUI : public PlugUIBase, public Gtk::VBox -- cgit v1.2.3