mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
UI/Qt: Ignore tab bar middle clicks if the user didn't click on a tab
This avoids a segfault that would previously occur when middle clicking to close a tab if only 1 tab was open.
This commit is contained in:
committed by
Andreas Kling
parent
d5926a3231
commit
b95c05b611
@@ -1156,8 +1156,10 @@ bool BrowserWindow::eventFilter(QObject* obj, QEvent* event)
|
|||||||
if (mouse_event->button() == Qt::MouseButton::MiddleButton) {
|
if (mouse_event->button() == Qt::MouseButton::MiddleButton) {
|
||||||
if (obj == m_tabs_container) {
|
if (obj == m_tabs_container) {
|
||||||
auto const tab_index = m_tabs_container->tabBar()->tabAt(mouse_event->pos());
|
auto const tab_index = m_tabs_container->tabBar()->tabAt(mouse_event->pos());
|
||||||
close_tab(tab_index);
|
if (tab_index != -1) {
|
||||||
return true;
|
close_tab(tab_index);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user