aboutsummaryrefslogtreecommitdiff
path: root/src/subwindow/tabwidget.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-05-28 22:05:45 +0300
committerAqua-sama <aqua@iserlohn-fortress.net>2020-05-29 14:33:05 +0300
commit149043a24273e5f02ed921e33c256567156fa95a (patch)
tree9cf19007a2dd055e75fb8d9d2335737ae90fb333 /src/subwindow/tabwidget.cpp
parentTurn on more warnings by default (diff)
downloadsmolbote-149043a24273e5f02ed921e33c256567156fa95a.tar.xz
Fix segfault in release build
When creating a WebView out of a Session struct, fall back to the default profile if one is not set, or a profile with that ID is not found. - Update PKGBUILD
Diffstat (limited to 'src/subwindow/tabwidget.cpp')
-rw-r--r--src/subwindow/tabwidget.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/subwindow/tabwidget.cpp b/src/subwindow/tabwidget.cpp
index 6f1e348..69f3b8a 100644
--- a/src/subwindow/tabwidget.cpp
+++ b/src/subwindow/tabwidget.cpp
@@ -42,8 +42,11 @@ TabWidget::TabWidget(SubWindow *parent)
// when changing tabs, give focus to the widget
// otherwise when closing tabs, the tabwidget will retain focus
connect(this, &TabWidget::currentChanged, this, [this](int index) {
- if(widget(index))
+ previous = current;
+ current = index;
+ /*if(widget(index)) {
widget(index)->setFocus();
+ }*/
});
// context menu
@@ -68,12 +71,6 @@ TabWidget::TabWidget(SubWindow *parent)
removeTab(i);
}
});
-
- //
- connect(this, &TabWidget::currentChanged, this, [this](int index) {
- previous = current;
- current = index;
- });
}
TabWidget::~TabWidget()
@@ -85,7 +82,9 @@ TabWidget::~TabWidget()
int TabWidget::addTab(WebView *view)
{
- Q_ASSERT_X(view != nullptr, "TabWidget::addTab", "Tried to add null view");
+ if(view == nullptr) {
+ return -1;
+ }
const int idx = QTabWidget::addTab(view, view->title());
connect(view, &WebView::titleChanged, [this, view](const QString &title) {
@@ -100,7 +99,6 @@ int TabWidget::addTab(WebView *view)
setTabIcon(current_idx, icon);
}
});
-
tabBar()->setTabData(idx, QVariant::fromValue<SubWindow::TabData>(SubWindow::TabData{}));
return idx;
}