From 83b2c150d9fcd02cc54576e3904a1b02e550545c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 11 Apr 2017 23:34:55 +0200 Subject: [PATCH] Fixed a segfault in batch mode. --- src/lay/layTechnologyController.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lay/layTechnologyController.cc b/src/lay/layTechnologyController.cc index 26fff7611..3f3c56b41 100644 --- a/src/lay/layTechnologyController.cc +++ b/src/lay/layTechnologyController.cc @@ -99,7 +99,13 @@ TechnologyController::update_after_change () // re-attach all events tl::Object::detach_from_all_events (); - lay::MainWindow::instance ()->current_view_changed_event.add (this, &TechnologyController::update_after_change); + lay::MainWindow *mw = lay::MainWindow::instance (); + lay::MacroController *mc = lay::MacroController::instance (); + + if (mw) { + mw->current_view_changed_event.add (this, &TechnologyController::update_after_change); + } + lay::Technologies::instance ()->technology_changed_event.add (this, &TechnologyController::technology_changed); lay::Technologies::instance ()->technologies_changed_event.add (this, &TechnologyController::technologies_changed); @@ -117,11 +123,10 @@ TechnologyController::update_after_change () m_active_technology = active_tech; - lay::MainWindow *mw = lay::MainWindow::instance (); if (mw) { mw->tech_message (tech_string_from_name (active_tech)); } - lay::MacroController *mc = lay::MacroController::instance (); + if (mc) { // TODO: let the macro controller monitor the active technology // need to do this since macros may be bound to the new technology