From ffeacd46308412100a8ac23c0eccd2af4ee79543 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 31 Jul 2017 23:13:36 +0200 Subject: [PATCH] Small bugfix: save options on tech setup page The effect was: when not having save options in the technology setup (for example, when migrating from 0.24 to 0.25), it was not possible to edit the save options page in the technology manager because the data slot of the save options wasn't initialized. --- src/lay/layTechSetupDialog.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lay/layTechSetupDialog.cc b/src/lay/layTechSetupDialog.cc index edddde5df..89ad42ca3 100644 --- a/src/lay/layTechSetupDialog.cc +++ b/src/lay/layTechSetupDialog.cc @@ -285,7 +285,14 @@ TechSaveOptionsEditorPage::setup () { for (std::vector< std::pair >::iterator page = m_pages.begin (); page != m_pages.end (); ++page) { if (page->first) { - page->first->setup (tech ()->save_layout_options ().get_options (page->second), tech ()); + const db::FormatSpecificWriterOptions *specific_options = tech ()->save_layout_options ().get_options (page->second); + std::auto_ptr default_options; + if (! specific_options) { + // In case there is no option object yet, create a first one for initialization + default_options.reset (StreamWriterPluginDeclaration::plugin_for_format (page->second)->create_specific_options ()); + specific_options = default_options.get (); + } + page->first->setup (specific_options, tech ()); } } } @@ -299,6 +306,7 @@ TechSaveOptionsEditorPage::commit () if (page->first) { db::FormatSpecificWriterOptions *specific_options = options.get_options (page->second); if (! specific_options) { + // Create a container for the options unless there is one already specific_options = StreamWriterPluginDeclaration::plugin_for_format (page->second)->create_specific_options (); options.set_options (specific_options); }