CONSIDER MERGING: avoid a segfault due to early delete of a LayoutView object

This commit is contained in:
Matthias Koefferlein 2022-05-07 18:39:56 +02:00
parent 3c11fe61c3
commit e6061ff96f
1 changed files with 3 additions and 1 deletions

View File

@ -2876,7 +2876,9 @@ MainWindow::close_view (int index)
view_closed_event (int (index));
delete view (index);
// delete the view later as it may still be needed by event handlers or similar
std::unique_ptr<lay::LayoutView> old_view (view (index));
mp_views.erase (mp_views.begin () + index, mp_views.begin () + index + 1);
if (index >= int (mp_views.size ())) {