diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-04-09 01:47:13 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-04-09 01:47:13 +0200 |
commit | ff449c705c5502a777a2cdd2a70304bf79ad9b21 (patch) | |
tree | 5bd7da41e6bee8166e2b70415f5ee20c06421ce2 /src | |
parent | Fix a weird edge case with persisted empty event ids (diff) | |
download | nheko-ff449c705c5502a777a2cdd2a70304bf79ad9b21.tar.xz |
Fix crash on exit
Diffstat (limited to 'src')
-rw-r--r-- | src/timeline/TimelineViewManager.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 45abff98..f15b0b14 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -145,19 +145,27 @@ TimelineViewManager::TimelineViewManager(CallManager *callManager, ChatPage *par static auto self = this; qmlRegisterSingletonType<MainWindow>( "im.nheko", 1, 0, "MainWindow", [](QQmlEngine *, QJSEngine *) -> QObject * { - return MainWindow::instance(); + auto ptr = MainWindow::instance(); + QQmlEngine::setObjectOwnership(ptr, QQmlEngine::CppOwnership); + return ptr; }); qmlRegisterSingletonType<TimelineViewManager>( "im.nheko", 1, 0, "TimelineManager", [](QQmlEngine *, QJSEngine *) -> QObject * { - return self; + auto ptr = self; + QQmlEngine::setObjectOwnership(ptr, QQmlEngine::CppOwnership); + return ptr; }); qmlRegisterSingletonType<UserSettings>( "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>( "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>(); |