aboutsummaryrefslogtreecommitdiff
path: root/src/browser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/browser.cpp')
-rw-r--r--src/browser.cpp39
1 files changed, 12 insertions, 27 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index db535f3..f4cadb5 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -1,22 +1,10 @@
-/*******************************************************************************
- **
- ** smolbote: yet another qute browser
- ** Copyright (C) 2017 Xian Nox
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see <http://www.gnu.org/licenses/>.
- **
- ******************************************************************************/
+/*
+ * This file is part of smolbote. It's copyrighted by the contributors recorded
+ * in the version control history of the file, available from its original
+ * location: git://neueland.iserlohn-fortress.net/smolbote.git
+ *
+ * SPDX-License-Identifier: GPL-3.0
+ */
#include "browser.h"
#include <bookmarks/bookmarkswidget.h>
@@ -35,12 +23,8 @@ Browser::Browser(int &argc, char *argv[]) :
Browser::~Browser()
{
- // TODO: fix crash here
-// qDeleteAll(m_windows);
-// m_windows.clear();
-
-// qDeleteAll(m_profiles);
-// m_profiles.clear();
+ // TODO: make sure all windows have saved their settings
+ // TODO: save session
}
void Browser::setConfiguration(std::shared_ptr<Configuration> &config)
@@ -69,14 +53,15 @@ void Browser::loadProfiles()
QDir profileDir(path);
const QStringList profileList = profileDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
+ // set profile parents to nullptr, otherwise both Browser and std::shared_ptr try to free them
for(const QString &name : profileList) {
- std::shared_ptr<WebEngineProfile> profile = std::make_shared<WebEngineProfile>(name, profileDir.absoluteFilePath(name), this);
+ std::shared_ptr<WebEngineProfile> profile = std::make_shared<WebEngineProfile>(name, profileDir.absoluteFilePath(name), nullptr);
profile->setRequestInterceptor(m_urlRequestInterceptor.get());
m_profiles.insert(name, profile);
}
// Also add the Off-the-record profile
- std::shared_ptr<WebEngineProfile> otr = std::make_shared<WebEngineProfile>(this);
+ std::shared_ptr<WebEngineProfile> otr = std::make_shared<WebEngineProfile>(nullptr);
otr->setRequestInterceptor(m_urlRequestInterceptor.get());
m_profiles.insert("", otr);