mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
QmlStaticData: Prevent deleting singletons by QML engine
This commit is contained in:
parent
231101151e
commit
a8d43ed0c8
@ -25,6 +25,8 @@
|
|||||||
#include "api/fileutils/qmlfileutils.h"
|
#include "api/fileutils/qmlfileutils.h"
|
||||||
#include "pluginproxy.h"
|
#include "pluginproxy.h"
|
||||||
|
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
QmlStaticData::QmlStaticData(QObject *parent)
|
QmlStaticData::QmlStaticData(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
@ -138,53 +140,62 @@ QIcon QmlStaticData::getIcon(const QString &iconPath, const QString &pluginPath)
|
|||||||
QmlBookmarks *QmlStaticData::getBookmarksSingleton()
|
QmlBookmarks *QmlStaticData::getBookmarksSingleton()
|
||||||
{
|
{
|
||||||
static QmlBookmarks *bookmarks = new QmlBookmarks(this);
|
static QmlBookmarks *bookmarks = new QmlBookmarks(this);
|
||||||
|
QQmlEngine::setObjectOwnership(bookmarks, QQmlEngine::CppOwnership);
|
||||||
return bookmarks;
|
return bookmarks;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlHistory *QmlStaticData::getHistorySingleton()
|
QmlHistory *QmlStaticData::getHistorySingleton()
|
||||||
{
|
{
|
||||||
static QmlHistory *history = new QmlHistory(this);
|
static QmlHistory *history = new QmlHistory(this);
|
||||||
|
QQmlEngine::setObjectOwnership(history, QQmlEngine::CppOwnership);
|
||||||
return history;
|
return history;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlCookies *QmlStaticData::getCookiesSingleton()
|
QmlCookies *QmlStaticData::getCookiesSingleton()
|
||||||
{
|
{
|
||||||
static QmlCookies *cookies = new QmlCookies(this);
|
static QmlCookies *cookies = new QmlCookies(this);
|
||||||
|
QQmlEngine::setObjectOwnership(cookies, QQmlEngine::CppOwnership);
|
||||||
return cookies;
|
return cookies;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlTopSites *QmlStaticData::getTopSitesSingleton()
|
QmlTopSites *QmlStaticData::getTopSitesSingleton()
|
||||||
{
|
{
|
||||||
static QmlTopSites *topSites = new QmlTopSites(this);
|
static QmlTopSites *topSites = new QmlTopSites(this);
|
||||||
|
QQmlEngine::setObjectOwnership(topSites, QQmlEngine::CppOwnership);
|
||||||
return topSites;
|
return topSites;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlTabs *QmlStaticData::getTabsSingleton()
|
QmlTabs *QmlStaticData::getTabsSingleton()
|
||||||
{
|
{
|
||||||
static QmlTabs *tabs = new QmlTabs(this);
|
static QmlTabs *tabs = new QmlTabs(this);
|
||||||
|
QQmlEngine::setObjectOwnership(tabs, QQmlEngine::CppOwnership);
|
||||||
return tabs;
|
return tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlClipboard *QmlStaticData::getClipboardSingleton()
|
QmlClipboard *QmlStaticData::getClipboardSingleton()
|
||||||
{
|
{
|
||||||
static QmlClipboard *clipboard = new QmlClipboard(this);
|
static QmlClipboard *clipboard = new QmlClipboard(this);
|
||||||
|
QQmlEngine::setObjectOwnership(clipboard, QQmlEngine::CppOwnership);
|
||||||
return clipboard;
|
return clipboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlWindows *QmlStaticData::getWindowsSingleton()
|
QmlWindows *QmlStaticData::getWindowsSingleton()
|
||||||
{
|
{
|
||||||
static QmlWindows *windows = new QmlWindows(this);
|
static QmlWindows *windows = new QmlWindows(this);
|
||||||
|
QQmlEngine::setObjectOwnership(windows, QQmlEngine::CppOwnership);
|
||||||
return windows;
|
return windows;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlExternalJsObject *QmlStaticData::getExternalJsObjectSingleton()
|
QmlExternalJsObject *QmlStaticData::getExternalJsObjectSingleton()
|
||||||
{
|
{
|
||||||
static QmlExternalJsObject *externalJsObject = new QmlExternalJsObject(this);
|
static QmlExternalJsObject *externalJsObject = new QmlExternalJsObject(this);
|
||||||
|
QQmlEngine::setObjectOwnership(externalJsObject, QQmlEngine::CppOwnership);
|
||||||
return externalJsObject;
|
return externalJsObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlUserScripts *QmlStaticData::getUserScriptsSingleton()
|
QmlUserScripts *QmlStaticData::getUserScriptsSingleton()
|
||||||
{
|
{
|
||||||
static QmlUserScripts *userScripts = new QmlUserScripts(this);
|
static QmlUserScripts *userScripts = new QmlUserScripts(this);
|
||||||
|
QQmlEngine::setObjectOwnership(userScripts, QQmlEngine::CppOwnership);
|
||||||
return userScripts;
|
return userScripts;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user