From ace0d420686be26ea88cca64406a7b6cf5e10260 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 22 May 2021 15:18:40 +0300 Subject: Set pageStack as the parent of dynamically created components It fixes segmentation fault when application window is closed. --- qml/ChatlistPage.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qml') diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml index 587de96..a92e7b8 100644 --- a/qml/ChatlistPage.qml +++ b/qml/ChatlistPage.qml @@ -37,7 +37,7 @@ Kirigami.ScrollablePage { onTriggered: { let settingsPageComponent = Qt.createComponent("qrc:/qml/SettingsPage.qml") if (settingsPageComponent.status == Component.Ready) { - let settingsPage = settingsPageComponent.createObject(chatlistPage, {context: chatlistPage.context}) + let settingsPage = settingsPageComponent.createObject(pageStack, {context: chatlistPage.context}) pageStack.layers.push(settingsPage) } else { console.log("Can't open Settings page") @@ -120,7 +120,7 @@ Kirigami.ScrollablePage { console.log("Depth is " + pageStack.depth) let chatPageComponent = Qt.createComponent("qrc:/qml/ChatPage.qml") if (chatPageComponent.status == Component.Ready) { - let myPage = chatPageComponent.createObject(chatlistPage, {chatId: chatId, context: chatlistPage.context, eventEmitter: chatlistPage.eventEmitter}) + let myPage = chatPageComponent.createObject(pageStack, {chatId: chatId, context: chatlistPage.context, eventEmitter: chatlistPage.eventEmitter}) if (pageStack.depth == 1) { pageStack.push(myPage) } else if (pageStack.depth == 2) { -- cgit v1.2.3-70-g09d2