mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-26 11:18:59 +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:
parent
d5926a3231
commit
b95c05b611
Notes:
sideshowbarker
2024-07-19 01:59:31 +09:00
Author: https://github.com/tcl3
Commit: b95c05b611
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/312
Issue: https://github.com/LadybirdBrowser/ladybird/issues/310
1 changed files with 4 additions and 2 deletions
|
@ -1156,8 +1156,10 @@ bool BrowserWindow::eventFilter(QObject* obj, QEvent* event)
|
|||
if (mouse_event->button() == Qt::MouseButton::MiddleButton) {
|
||||
if (obj == m_tabs_container) {
|
||||
auto const tab_index = m_tabs_container->tabBar()->tabAt(mouse_event->pos());
|
||||
close_tab(tab_index);
|
||||
return true;
|
||||
if (tab_index != -1) {
|
||||
close_tab(tab_index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue