diff --git a/src/laybasic/laybasic/layLayoutViewBase.cc b/src/laybasic/laybasic/layLayoutViewBase.cc index c697441fc..fec06c57d 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.cc +++ b/src/laybasic/laybasic/layLayoutViewBase.cc @@ -260,8 +260,6 @@ LayoutViewBase::LayoutViewBase (lay::LayoutView *ui, db::Manager *manager, bool { // either it's us or the parent has a dispatcher tl_assert (dispatcher () != 0); - - init (manager); } void diff --git a/src/laybasic/laybasic/layLayoutViewBase.h b/src/laybasic/laybasic/layLayoutViewBase.h index 0f8281458..db5e2c628 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.h +++ b/src/laybasic/laybasic/layLayoutViewBase.h @@ -192,11 +192,6 @@ public: */ LayoutViewBase (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal); - /** - * @brief Constructor - */ - LayoutViewBase (lay::LayoutView *ui, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal); - /** * @brief Destructor */ @@ -2861,8 +2856,6 @@ private: tl::Clock m_clock, m_last_checked; - void init (db::Manager *mgr); - void do_prop_changed (); void do_redraw (int layer); void do_redraw (); @@ -2891,6 +2884,13 @@ private: void merge_dither_pattern (lay::LayerPropertiesList &props); protected: + /** + * @brief Constructor for calling from a LayoutView + */ + LayoutViewBase (lay::LayoutView *ui, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options = (unsigned int) LV_Normal); + + void init (db::Manager *mgr); + lay::Plugin *active_plugin () const { return mp_active_plugin; diff --git a/src/layview/layview/layLayoutView_noqt.cc b/src/layview/layview/layLayoutView_noqt.cc index b43775a3a..fd8e8b028 100644 --- a/src/layview/layview/layLayoutView_noqt.cc +++ b/src/layview/layview/layLayoutView_noqt.cc @@ -30,6 +30,8 @@ namespace lay LayoutView::LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options) : LayoutViewBase (this, mgr, editable, plugin_parent, options) { + // NOTE: it's important to call LayoutViewBase::init from a fully constructed LayoutView (issue #1360) + LayoutViewBase::init (mgr); config_setup (); finish (); } @@ -37,6 +39,8 @@ LayoutView::LayoutView (db::Manager *mgr, bool editable, lay::Plugin *plugin_par LayoutView::LayoutView (lay::LayoutView *source, db::Manager *mgr, bool editable, lay::Plugin *plugin_parent, unsigned int options) : LayoutViewBase (this, mgr, editable, plugin_parent, options) { + // NOTE: it's important to call LayoutViewBase::init from a fully constructed LayoutView (issue #1360) + LayoutViewBase::init (mgr); copy_from (source); config_setup (); finish (); diff --git a/src/layview/layview/layLayoutView_qt.cc b/src/layview/layview/layLayoutView_qt.cc index fe9010206..9b3f04286 100644 --- a/src/layview/layview/layLayoutView_qt.cc +++ b/src/layview/layview/layLayoutView_qt.cc @@ -279,7 +279,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin // ensures the deferred method scheduler is present tl::DeferredMethodScheduler::instance (); - init_ui (); + init_ui (manager); } LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, unsigned int options) @@ -290,7 +290,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit // ensures the deferred method scheduler is present tl::DeferredMethodScheduler::instance (); - init_ui (); + init_ui (manager); copy_from (source); @@ -306,7 +306,7 @@ LayoutView::LayoutView (db::Manager *manager, bool editable, lay::Plugin *plugin // ensures the deferred method scheduler is present tl::DeferredMethodScheduler::instance (); - init_ui (); + init_ui (manager); } LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool editable, lay::Plugin *plugin_parent, LayoutViewWidget *widget, unsigned int options) @@ -317,7 +317,7 @@ LayoutView::LayoutView (lay::LayoutView *source, db::Manager *manager, bool edit // ensures the deferred method scheduler is present tl::DeferredMethodScheduler::instance (); - init_ui (); + init_ui (manager); copy_from (source); @@ -349,7 +349,7 @@ LayoutView::event_filter (QObject *obj, QEvent *event, bool &taken) } void -LayoutView::init_ui () +LayoutView::init_ui (db::Manager *mgr) { m_activated = true; m_always_show_source = false; @@ -373,6 +373,10 @@ LayoutView::init_ui () mp_min_hier_spbx = 0; mp_max_hier_spbx = 0; + // NOTE: it's important to call LayoutViewBase::init from LayoutView because creating the plugins will need a + // fully constructed LayoutView (issue #1360) + LayoutViewBase::init (mgr); + if (mp_widget) { canvas ()->init_ui (mp_widget); diff --git a/src/layview/layview/layLayoutView_qt.h b/src/layview/layview/layLayoutView_qt.h index b32ec4f12..294f85f70 100644 --- a/src/layview/layview/layLayoutView_qt.h +++ b/src/layview/layview/layLayoutView_qt.h @@ -627,7 +627,7 @@ private: bool event_filter (QObject *obj, QEvent *ev, bool &taken); QSize size_hint () const; - void init_ui (); + void init_ui (db::Manager *manager); void do_setup_editor_options_pages (); QWidget *layer_control_frame () { return mp_control_frame; }