mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Fix crash on exit
This commit is contained in:
parent
c8a547630b
commit
ff449c705c
1 changed files with 12 additions and 4 deletions
|
@ -145,19 +145,27 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par
|
||||||
static auto self = this;
|
static auto self = this;
|
||||||
qmlRegisterSingletonType<MainWindow>(
|
qmlRegisterSingletonType<MainWindow>(
|
||||||
"im.nheko", 1, 0, "MainWindow", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
"im.nheko", 1, 0, "MainWindow", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
||||||
return MainWindow::instance();
|
auto ptr = MainWindow::instance();
|
||||||
|
QQmlEngine::setObjectOwnership(ptr, QQmlEngine::CppOwnership);
|
||||||
|
return ptr;
|
||||||
});
|
});
|
||||||
qmlRegisterSingletonType<TimelineViewManager>(
|
qmlRegisterSingletonType<TimelineViewManager>(
|
||||||
"im.nheko", 1, 0, "TimelineManager", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
"im.nheko", 1, 0, "TimelineManager", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
||||||
return self;
|
auto ptr = self;
|
||||||
|
QQmlEngine::setObjectOwnership(ptr, QQmlEngine::CppOwnership);
|
||||||
|
return ptr;
|
||||||
});
|
});
|
||||||
qmlRegisterSingletonType<UserSettings>(
|
qmlRegisterSingletonType<UserSettings>(
|
||||||
"im.nheko", 1, 0, "Settings", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
"im.nheko", 1, 0, "Settings", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
||||||
return ChatPage::instance()->userSettings().data();
|
auto ptr = ChatPage::instance()->userSettings().data();
|
||||||
|
QQmlEngine::setObjectOwnership(ptr, QQmlEngine::CppOwnership);
|
||||||
|
return ptr;
|
||||||
});
|
});
|
||||||
qmlRegisterSingletonType<CallManager>(
|
qmlRegisterSingletonType<CallManager>(
|
||||||
"im.nheko", 1, 0, "CallManager", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
"im.nheko", 1, 0, "CallManager", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
||||||
return ChatPage::instance()->callManager();
|
auto ptr = ChatPage::instance()->callManager();
|
||||||
|
QQmlEngine::setObjectOwnership(ptr, QQmlEngine::CppOwnership);
|
||||||
|
return ptr;
|
||||||
});
|
});
|
||||||
|
|
||||||
qRegisterMetaType<mtx::events::collections::TimelineEvents>();
|
qRegisterMetaType<mtx::events::collections::TimelineEvents>();
|
||||||
|
|
Loading…
Reference in a new issue