Don't destroy components in use

Add a delay to all destructions and move the call dialog stuff up a
level, so that we don't destroy the component when destroying the parent
dialog.

fixes #984
This commit is contained in:
Nicolas Werner 2022-03-10 20:42:12 +01:00
parent a3dce85132
commit bf7b58c959
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
4 changed files with 16 additions and 18 deletions

View file

@ -29,6 +29,14 @@ Rectangle {
}
Component {
id: screenShareDialog
ScreenShare {
}
}
RowLayout {
id: row

View file

@ -222,12 +222,12 @@ Pane {
}
function destroyOnClose(obj) {
if (obj.closing != undefined) obj.closing.connect(() => obj.destroy());
else if (obj.closed != undefined) obj.closed.connect(() => obj.destroy());
if (obj.closing != undefined) obj.closing.connect(() => obj.destroy(1000));
else if (obj.aboutToHide != undefined) obj.aboutToHide.connect(() => obj.destroy(1000));
}
function destroyOnClosed(obj) {
obj.closed.connect(() => obj.destroy());
obj.aboutToHide.connect(() => obj.destroy(1000));
}
Connections {

View file

@ -28,14 +28,6 @@ Popup {
}
Component {
id: screenShareDialog
ScreenShare {
}
}
ColumnLayout {
id: columnLayout
@ -81,7 +73,7 @@ Popup {
height: Nheko.avatarSize
url: room.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: room.roomName
roomid: room.roomid
roomid: room.roomId
onClicked: TimelineManager.openImageOverlay(room, room.avatarUrl(userid), room.data.eventId)
}
@ -118,8 +110,8 @@ Popup {
onClicked: {
var dialog = screenShareDialog.createObject(timelineRoot);
dialog.open();
close();
timelineRoot.destroyOnClose(dialog);
close();
}
}

View file

@ -11,12 +11,10 @@ import im.nheko 1.0
Popup {
modal: true
// only set the anchors on Qt 5.12 or higher
// see https://doc.qt.io/qt-5/qml-qtquick-controls2-popup.html#anchors.centerIn-prop
Component.onCompleted: {
if (anchors)
anchors.centerIn = parent;
anchors.centerIn: parent;
Component.onCompleted: {
frameRateCombo.currentIndex = frameRateCombo.find(Settings.screenShareFrameRate);
}
palette: Nheko.colors