mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[CodeCleanup] Removed all disconnectObjects() methods
I don't think we need this hack anymore.
This commit is contained in:
parent
07cf7036df
commit
d2528417d1
@ -147,6 +147,13 @@ BrowserWindow::BrowserWindow(Qz::BrowserWindowType type, const QUrl &startUrl)
|
||||
|
||||
BrowserWindow::~BrowserWindow()
|
||||
{
|
||||
mApp->plugins()->emitMainWindowDeleted(this);
|
||||
|
||||
foreach (const QPointer<QWidget> &pointer, m_deleteOnCloseWidgets) {
|
||||
if (pointer) {
|
||||
pointer->deleteLater();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWindow::setStartTab(WebTab* tab)
|
||||
@ -1453,7 +1460,6 @@ void BrowserWindow::closeEvent(QCloseEvent* event)
|
||||
#ifndef Q_OS_MAC
|
||||
if (mApp->windowCount() == 1) {
|
||||
if (quitApp()) {
|
||||
disconnectObjects();
|
||||
event->accept();
|
||||
}
|
||||
else {
|
||||
@ -1464,7 +1470,6 @@ void BrowserWindow::closeEvent(QCloseEvent* event)
|
||||
}
|
||||
#endif
|
||||
|
||||
disconnectObjects();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
@ -1480,37 +1485,6 @@ SearchToolBar* BrowserWindow::searchToolBar() const
|
||||
return toolBar;
|
||||
}
|
||||
|
||||
void BrowserWindow::disconnectObjects()
|
||||
{
|
||||
// Disconnecting all important widgets before deleting this window
|
||||
// so it cannot happen that slots will be invoked after the object
|
||||
// is deleted.
|
||||
// We have to do it this way, because ~QObject is deleting all child
|
||||
// objects with plain delete - not deleteLater().
|
||||
//
|
||||
// Also using own disconnectObjects() method, not default disconnect()
|
||||
// because we need to retain connections to destroyed(QObject*) signal
|
||||
// in order to avoid crashes for example with setting stylesheets
|
||||
// (QStyleSheet backend is holding list of all widgets)
|
||||
|
||||
m_tabWidget->disconnectObjects();
|
||||
m_tabWidget->getTabBar()->disconnectObjects();
|
||||
|
||||
foreach (WebTab* tab, m_tabWidget->allTabs()) {
|
||||
tab->disconnectObjects();
|
||||
tab->view()->disconnectObjects();
|
||||
tab->view()->page()->disconnectObjects();
|
||||
}
|
||||
|
||||
foreach (const QPointer<QWidget> &pointer, m_deleteOnCloseWidgets) {
|
||||
if (pointer) {
|
||||
pointer.data()->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
mApp->plugins()->emitMainWindowDeleted(this);
|
||||
}
|
||||
|
||||
void BrowserWindow::closeWindow()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
|
@ -175,8 +175,6 @@ private:
|
||||
void setupUi();
|
||||
void setupMenu();
|
||||
|
||||
void disconnectObjects();
|
||||
|
||||
bool m_isClosing;
|
||||
bool m_isStarting;
|
||||
QUrl m_startUrl;
|
||||
|
@ -626,7 +626,6 @@ void MainApplication::quitApplication()
|
||||
}
|
||||
|
||||
m_isClosing = true;
|
||||
m_networkManager->disconnectObjects();
|
||||
|
||||
// Saving settings in saveSettings() slot called from quit() so
|
||||
// everything gets saved also when quitting application in other
|
||||
@ -704,7 +703,6 @@ void MainApplication::saveSettings()
|
||||
}
|
||||
|
||||
m_isClosing = true;
|
||||
m_networkManager->disconnectObjects();
|
||||
|
||||
Settings settings;
|
||||
settings.beginGroup("SessionRestore");
|
||||
|
@ -748,8 +748,3 @@ void NetworkManager::loadCertificates()
|
||||
new CaBundleUpdater(this, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void NetworkManager::disconnectObjects()
|
||||
{
|
||||
disconnect(this);
|
||||
}
|
||||
|
@ -57,8 +57,6 @@ public:
|
||||
bool registerSchemeHandler(const QString &scheme, SchemeHandler* handler);
|
||||
bool unregisterSchemeHandler(const QString &scheme, SchemeHandler* handler);
|
||||
|
||||
void disconnectObjects();
|
||||
|
||||
signals:
|
||||
void sslDialogClosed();
|
||||
|
||||
|
@ -57,10 +57,3 @@ QNetworkReply* NetworkManagerProxy::createRequest(QNetworkAccessManager::Operati
|
||||
|
||||
return QNetworkAccessManager::createRequest(op, request, outgoingData);
|
||||
}
|
||||
|
||||
void NetworkManagerProxy::disconnectObjects()
|
||||
{
|
||||
m_page = 0;
|
||||
|
||||
disconnect(m_manager);
|
||||
}
|
||||
|
@ -35,8 +35,6 @@ public:
|
||||
|
||||
QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData);
|
||||
|
||||
void disconnectObjects();
|
||||
|
||||
private:
|
||||
WebPage* m_page;
|
||||
NetworkManager* m_manager;
|
||||
|
@ -210,7 +210,6 @@ void PopupWindow::closeEvent(QCloseEvent* event)
|
||||
return;
|
||||
}
|
||||
|
||||
m_page->disconnectObjects();
|
||||
m_view->deleteLater();
|
||||
|
||||
event->accept();
|
||||
|
@ -746,8 +746,3 @@ void TabBar::dropEvent(QDropEvent* event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TabBar::disconnectObjects()
|
||||
{
|
||||
disconnect(this);
|
||||
}
|
||||
|
@ -44,8 +44,6 @@ public:
|
||||
|
||||
void updatePinnedTabCloseButton(int index);
|
||||
|
||||
void disconnectObjects();
|
||||
|
||||
void wheelEvent(QWheelEvent* event);
|
||||
|
||||
signals:
|
||||
|
@ -305,11 +305,3 @@ void TabbedWebView::mouseMoveEvent(QMouseEvent* event)
|
||||
|
||||
WebView::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void TabbedWebView::disconnectObjects()
|
||||
{
|
||||
disconnect(this);
|
||||
disconnect(m_window->statusBar());
|
||||
|
||||
WebView::disconnectObjects();
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ public:
|
||||
void moveToWindow(BrowserWindow* window);
|
||||
|
||||
QWidget* overlayForJsAlert();
|
||||
void disconnectObjects();
|
||||
|
||||
signals:
|
||||
void wantsCloseTab(int);
|
||||
|
@ -464,7 +464,6 @@ void TabWidget::closeTab(int index, bool force)
|
||||
}
|
||||
|
||||
TabbedWebView* webView = webTab->view();
|
||||
WebPage* webPage = webView->page();
|
||||
|
||||
// Don't close restore page!
|
||||
if (!force && webView->url().toString() == QL1S("qupzilla:restore") && mApp->restoreManager()) {
|
||||
@ -506,10 +505,6 @@ void TabWidget::closeTab(int index, bool force)
|
||||
|
||||
m_lastBackgroundTabIndex = -1;
|
||||
|
||||
webPage->disconnectObjects();
|
||||
webView->disconnectObjects();
|
||||
webTab->disconnectObjects();
|
||||
|
||||
if (!m_closedInsteadOpened && m_menuTabs->isVisible()) {
|
||||
QAction* labelAction = m_menuTabs->actions().last();
|
||||
labelAction->setText(tr("Currently you have %n opened tab(s)", "", count() - 1));
|
||||
@ -1033,14 +1028,6 @@ void TabWidget::closeRecoveryTab()
|
||||
}
|
||||
}
|
||||
|
||||
void TabWidget::disconnectObjects()
|
||||
{
|
||||
disconnect(this);
|
||||
disconnect(mApp);
|
||||
disconnect(m_window);
|
||||
disconnect(m_window->ipLabel());
|
||||
}
|
||||
|
||||
TabWidget::~TabWidget()
|
||||
{
|
||||
delete m_closedTabsManager;
|
||||
|
@ -103,8 +103,6 @@ public:
|
||||
ToolButton* buttonListTabs() const;
|
||||
AddTabButton* buttonAddTab() const;
|
||||
|
||||
void disconnectObjects();
|
||||
|
||||
public slots:
|
||||
int addView(const QUrl &url, const Qz::NewTabPositionFlags &openFlags, bool selectLine = false, bool pinned = false);
|
||||
int addView(const QNetworkRequest &req, const Qz::NewTabPositionFlags &openFlags, bool selectLine = false, bool pinned = false);
|
||||
|
@ -116,6 +116,18 @@ WebPage::WebPage(QObject* parent)
|
||||
s_livingPages.append(this);
|
||||
}
|
||||
|
||||
WebPage::~WebPage()
|
||||
{
|
||||
mApp->plugins()->emitWebPageDeleted(this);
|
||||
|
||||
if (m_runningLoop) {
|
||||
m_runningLoop->exit(1);
|
||||
m_runningLoop = 0;
|
||||
}
|
||||
|
||||
s_livingPages.removeOne(this);
|
||||
}
|
||||
|
||||
QUrl WebPage::url() const
|
||||
{
|
||||
return mainFrame()->url();
|
||||
@ -1044,28 +1056,3 @@ bool WebPage::isPointerSafeToUse(WebPage* page)
|
||||
|
||||
return page == 0 ? false : s_livingPages.contains(page);
|
||||
}
|
||||
|
||||
void WebPage::disconnectObjects()
|
||||
{
|
||||
if (m_runningLoop) {
|
||||
m_runningLoop->exit(1);
|
||||
m_runningLoop = 0;
|
||||
}
|
||||
|
||||
s_livingPages.removeOne(this);
|
||||
|
||||
disconnect(this);
|
||||
m_networkProxy->disconnectObjects();
|
||||
|
||||
mApp->plugins()->emitWebPageDeleted(this);
|
||||
}
|
||||
|
||||
WebPage::~WebPage()
|
||||
{
|
||||
if (m_runningLoop) {
|
||||
m_runningLoop->exit(1);
|
||||
m_runningLoop = 0;
|
||||
}
|
||||
|
||||
s_livingPages.removeOne(this);
|
||||
}
|
||||
|
@ -84,7 +84,6 @@ public:
|
||||
QString userAgentForUrl(const QUrl &url) const;
|
||||
|
||||
static bool isPointerSafeToUse(WebPage* page);
|
||||
void disconnectObjects();
|
||||
|
||||
signals:
|
||||
void privacyChanged(bool status);
|
||||
|
@ -380,13 +380,6 @@ void WebTab::pinTab(int index)
|
||||
tabWidget->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void WebTab::disconnectObjects()
|
||||
{
|
||||
disconnect(this);
|
||||
disconnect(m_locationBar.data());
|
||||
disconnect(m_view);
|
||||
}
|
||||
|
||||
WebTab::~WebTab()
|
||||
{
|
||||
delete m_locationBar.data();
|
||||
|
@ -95,8 +95,6 @@ public:
|
||||
|
||||
QPixmap renderTabPreview();
|
||||
|
||||
void disconnectObjects();
|
||||
|
||||
private slots:
|
||||
void showNotification(QWidget* notif);
|
||||
void slotRestore();
|
||||
|
@ -1533,8 +1533,3 @@ bool WebView::eventFilter(QObject* obj, QEvent* event)
|
||||
#endif
|
||||
return QWebView::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
void WebView::disconnectObjects()
|
||||
{
|
||||
disconnect(this);
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ public:
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
|
||||
virtual QWidget* overlayForJsAlert() = 0;
|
||||
virtual void disconnectObjects();
|
||||
|
||||
static bool isUrlValid(const QUrl &url);
|
||||
static QUrl guessUrlFromString(const QString &string);
|
||||
|
Loading…
Reference in New Issue
Block a user