Commit 1b8a5312 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

S&R: fix crash when closing search tabs

Always call QTabWidget::removeTab() so that the widget represented by that
tab is removed from the underlying QStackedWidget, otherwise the code could
try accessing a MatchModel object that has already been deleted as its parent
Results object has been deleted.

Only set m_curResults to nullptr if it belongs to the tab being closed,
e.g. if you have two or more search tabs, you can click the close button
of a tab other than the current one.
parent 40c37372
......@@ -1973,9 +1973,15 @@ void KatePluginSearchView::tabCloseRequested(int index)
cancelDiskFileSearch();
m_folderFilesList.terminateSearch();
}
if (m_ui.resultTabWidget->count() > 1) {
delete tmp; // remove the tab
m_curResults = nullptr;
m_ui.resultTabWidget->removeTab(index);
if (m_curResults == tmp) {
delete m_curResults;
m_curResults = nullptr;
} else {
delete tmp;
}
}
updateMatchMarks();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment