diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2019-01-18 16:56:54 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2019-01-18 16:56:54 +0100 |
commit | 9e73d0dac0774955348a5164087363c5b33927b8 (patch) | |
tree | 61eb5d729c4e48e1fabe596f387a3e67a1d1d415 /src/mainwindow/mainwindow.cpp | |
parent | Rewrite lib/web to lib/webprofile (diff) | |
download | smolbote-9e73d0dac0774955348a5164087363c5b33927b8.tar.xz |
Add tools/report-clang-tidy.sh
- Fix various clang-tidy warnings
- Fix use-after-free crash when deleting profiles
Diffstat (limited to 'src/mainwindow/mainwindow.cpp')
-rw-r--r-- | src/mainwindow/mainwindow.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 71b594a..7fb7d9e 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -69,7 +69,7 @@ MainWindow::MainWindow(const std::unique_ptr<Configuration> &config, QWidget *pa config->setShortcut(subwindowMenuAction, "subwindow.shortcuts.menu"); connect(subwindowMenuAction, &QAction::triggered, this, [this]() { QMdiSubWindow *window = mdiArea->currentSubWindow(); - if(window) { + if(window != nullptr) { // show the menu at the subwindow position // position has to be global, and mapped by the mdiArea (parentWidget() of the subwindow) const auto position = mdiArea->mapToGlobal(window->pos()); @@ -114,20 +114,20 @@ MainWindow::MainWindow(const std::unique_ptr<Configuration> &config, QWidget *pa // address bar connect(addressBar, &AddressBar::search, this, [this](const QString &term) { - if(this->currentView) { + if(this->currentView != nullptr) { currentView->search(term); currentView->setFocus(); } }); connect(addressBar, &AddressBar::load, this, [this](const QUrl &url) { - if(this->currentView) { + if(this->currentView != nullptr) { currentView->load(url); currentView->setFocus(); } }); connect(addressBar, &AddressBar::giveFocus, this, [this]() { - if(this->currentView) { + if(this->currentView != nullptr) { currentView->setFocus(); } }); @@ -244,13 +244,13 @@ SubWindow *MainWindow::createSubWindow(WebProfile *profile, bool openProfileNewt void MainWindow::setView(WebView *view) { - if(currentView) { + if(currentView != nullptr) { // disconnect old view - disconnect(currentView, 0, addressBar, 0); + disconnect(currentView, nullptr, addressBar, nullptr); } currentView = view; - if(view) { + if(view != nullptr) { connect(view, &WebView::urlChanged, addressBar, &AddressBar::setUrl); addressBar->setUrl(view->url()); @@ -277,7 +277,7 @@ void MainWindow::closeEvent(QCloseEvent *event) } mdiArea->closeAllSubWindows(); - if(mdiArea->currentSubWindow()) + if(mdiArea->currentSubWindow() != nullptr) event->ignore(); else event->accept(); |