[vlc-devel] [PATCH 1/4] qml: avoid crash at exit when dismissing dialog
Alexandre Janniaux
ajanni at videolabs.io
Thu Feb 6 16:52:36 CET 2020
Hi,
Patchset LGTM,
Regards,
--
Alexandre Janniaux
Videolabs
On Thu, Feb 06, 2020 at 02:10:12PM +0100, Pierre Lamot wrote:
> loginDialog.dialogId stayed defined (hence dissmissed at exit) when
> accepting/dismissing the dialog without clicking on a button
> ---
> .../gui/qt/dialogs/dialogs/qml/Dialogs.qml | 24 ++++++++++++-------
> 1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/modules/gui/qt/dialogs/dialogs/qml/Dialogs.qml b/modules/gui/qt/dialogs/dialogs/qml/Dialogs.qml
> index 08df8c67c4..e45abb489d 100644
> --- a/modules/gui/qt/dialogs/dialogs/qml/Dialogs.qml
> +++ b/modules/gui/qt/dialogs/dialogs/qml/Dialogs.qml
> @@ -163,8 +163,7 @@ Item {
> KeyNavigation.up: savePassword
> KeyNavigation.right: loginOk
> onClicked: {
> - dialogModel.dismiss(loginDialog.dialogId)
> - loginDialog.dialogId = undefined
> + loginDialog.reject()
> loginDialog.close()
> }
> }
> @@ -176,8 +175,7 @@ Item {
> focus: true
> KeyNavigation.up: savePassword
> onClicked: {
> - dialogModel.post_login(loginDialog.dialogId, username.text, password.text, savePassword.checked)
> - loginDialog.dialogId = undefined
> + loginDialog.accept()
> loginDialog.close()
> }
> }
> @@ -186,10 +184,16 @@ Item {
> }
>
> onAccepted: {
> - dialogModel.post_login(dialogId, username.text, password.text, savePassword.checked)
> + if (loginDialog.dialogId !== undefined) {
> + dialogModel.post_login(loginDialog.dialogId, username.text, password.text, savePassword.checked)
> + loginDialog.dialogId = undefined
> + }
> }
> onRejected: {
> - dialogModel.dismiss(dialogId)
> + if (loginDialog.dialogId !== undefined) {
> + dialogModel.dismiss(loginDialog.dialogId)
> + loginDialog.dialogId = undefined
> + }
> }
> }
>
> @@ -302,9 +306,11 @@ Item {
> onCancelled: {
> if (questionDialog.dialogId === dialogId) {
> questionDialog.close()
> + questionDialog.dialogId = undefined
> dialogModel.dismiss(dialogId)
> } else if (loginDialog.dialogId === dialogId) {
> loginDialog.close()
> + loginDialog.dialogId = undefined
> dialogModel.dismiss(dialogId)
> } else {
> dialogModel.dismiss(dialogId)
> @@ -312,10 +318,12 @@ Item {
> }
>
> Component.onDestruction: {
> - if (questionDialog.dialogId) {
> + if (questionDialog.dialogId !== undefined) {
> dialogModel.dismiss(questionDialog.dialogId)
> - } if (loginDialog.dialogId) {
> + questionDialog.dialogId = undefined
> + } if (loginDialog.dialogId !== undefined) {
> dialogModel.dismiss(loginDialog.dialogId)
> + loginDialog.dialogId = undefined
> }
> }
> }
> --
> 2.17.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list