WIP: avoid a segfault when closing tab while dragging an instance.

This commit is contained in:
Matthias Koefferlein 2020-08-11 09:44:59 +02:00
parent 649d6da1b8
commit 1ea29dd9f3
3 changed files with 21 additions and 6 deletions

View File

@ -579,13 +579,18 @@ void
EditorOptionsInst::update_cell_edits ()
{
db::Layout *layout = 0;
lay::LayoutView *view = lay::LayoutView::current ();
// find the layout the cell has to be looked up: that is either the layout of the current instance or
// the library selected
if (mp_ui->lib_cbx->current_library ()) {
layout = &mp_ui->lib_cbx->current_library ()->layout ();
} else {
layout = &lay::LayoutView::current ()->cellview (m_cv_index)->layout ();
} else if (view && view->cellview (m_cv_index).is_valid ()) {
layout = &view->cellview (m_cv_index)->layout ();
}
if (! layout) {
return;
}
std::pair<bool, db::pcell_id_type> pc = layout->pcell_by_name (tl::to_string (mp_ui->cell_le->text ()).c_str ());

View File

@ -403,11 +403,10 @@ activate_service (lay::LayoutView *view, const lay::PluginDeclaration *pd, bool
return;
}
// @@@ TODO: this is very inefficient as each "activate" will regenerate the tabs
// TODO: this is very inefficient as each "activate" will regenerate the tabs
for (std::vector<edt::EditorOptionsPage *>::const_iterator op = eo_pages->pages ().begin (); op != eo_pages->pages ().end (); ++op) {
(*op)->activate (((*op)->plugin_declaration () == pd || ! (*op)->plugin_declaration ()) && active);
}
}
void

View File

@ -537,12 +537,11 @@ MainWindow::MainWindow (QApplication *app, lay::Plugin *plugin_parent, const cha
m_libs_visible = true;
mp_eo_dock_widget = new QDockWidget (QObject::tr ("Editor Options"), this);
mp_eo_dock_widget->hide ();
mp_eo_dock_widget->setObjectName (QString::fromUtf8 ("eo_dock_widget"));
mp_eo_stack = new ControlWidgetStack (mp_eo_dock_widget, "eo_stack");
mp_eo_dock_widget->setWidget (mp_eo_stack);
connect (mp_eo_dock_widget, SIGNAL (visibilityChanged (bool)), this, SLOT (dock_widget_visibility_changed (bool)));
m_eo_visible = false;
m_eo_visible = true;
mp_bm_dock_widget = new QDockWidget (QObject::tr ("Bookmarks"), this);
mp_bm_dock_widget->setObjectName (QString::fromUtf8 ("bookmarks_dock_widget"));
@ -939,6 +938,7 @@ MainWindow::show ()
void
MainWindow::close_all ()
{
cancel ();
mp_layer_toolbox->set_view (0);
// try a smooth shutdown of the current view
@ -1151,9 +1151,18 @@ MainWindow::config_finalize ()
// Not set the window state: this ensures we have handled cfg_window_geometry
// before we restore the state
if (! m_config_window_state.empty ()) {
QByteArray state = QByteArray::fromBase64 (m_config_window_state.c_str ());
m_config_window_state.clear ();
bool eo_visible = m_eo_visible;
restoreState (state);
// Keep the editor options visibility state
m_eo_visible = eo_visible;
show_dock_widget (mp_eo_dock_widget, m_eo_visible);
}
// Update the default grids menu if necessary
@ -3025,6 +3034,8 @@ MainWindow::close_view (int index)
{
if (view (index)) {
cancel ();
// this suppresses view_selected events that would otherwise be created
bool f = m_disable_tab_selected;
m_disable_tab_selected = true;