Fixed bug : Crash on closing empty tab after Settings opened. (#577)

Just one little change was needed, the setSelectionBehaviorOnRemove() function was to be executed before comparing the index with m_settingsIndex.
This commit is contained in:
Rishabh Soni 2021-01-29 01:45:42 +05:30 committed by GitHub
parent f91f4b15d9
commit 73aae9a610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,6 +177,7 @@ void TabBar::triggerWebPageAction(QWebEnginePage::WebAction action, ZimView *wid
void TabBar::closeTab(int index)
{
setSelectionBehaviorOnRemove(index);
if (index == 0 || index == this->count() - 1)
return;
if (index == m_settingsIndex) {
@ -185,7 +186,6 @@ void TabBar::closeTab(int index)
if (index < m_settingsIndex) {
m_settingsIndex--;
}
setSelectionBehaviorOnRemove(index);
auto webview = widget(index);
mp_stackedWidget->removeWidget(webview);
webview->setParent(nullptr);