[vlc-devel] [PATCH 1/4] qml: avoid crash at exit when dismissing dialog

Pierre Lamot pierre at videolabs.io
Thu Feb 13 10:04:32 CET 2020


ping

On 2020-02-06 14:10, 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
>              }
>          }
>      }


More information about the vlc-devel mailing list