ui: fix dcl unregister
diff mbox series

Message ID 20171109073759.5910-1-kraxel@redhat.com
State New
Headers show
Series
  • ui: fix dcl unregister
Related show

Commit Message

Gerd Hoffmann Nov. 9, 2017, 7:37 a.m. UTC
register checks for dcl->ds being NULL, to avoid registering
the same dcl twice.

Therefore dcl->ds must be cleared on unregister, otherwise
un-registering and re-registering doesn't work.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1510809
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/console.c | 1 +
 ui/vnc.c     | 2 ++
 2 files changed, 3 insertions(+)

Comments

Marc-André Lureau Nov. 9, 2017, 10:39 a.m. UTC | #1
Hi

On Thu, Nov 9, 2017 at 8:37 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> register checks for dcl->ds being NULL, to avoid registering
> the same dcl twice.
>
> Therefore dcl->ds must be cleared on unregister, otherwise
> un-registering and re-registering doesn't work.
>
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1510809
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  ui/console.c | 1 +
>  ui/vnc.c     | 2 ++
>  2 files changed, 3 insertions(+)
>
> diff --git a/ui/console.c b/ui/console.c
> index eca854cbd5..c4c95abed7 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -1471,6 +1471,7 @@ void unregister_displaychangelistener(DisplayChangeListener *dcl)
>          dcl->con->dcls--;
>      }
>      QLIST_REMOVE(dcl, next);
> +    dcl->ds = NULL;
>      gui_setup_refresh(ds);
>  }
>
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 9f8d5a1b1f..bd46f11fcc 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -3044,6 +3044,7 @@ void vnc_display_init(const char *id)
>  {
>      VncDisplay *vd;
>
> +    fprintf(stderr, "%s: %s\n", __func__, id);
>      if (vnc_display_find(id) != NULL) {
>          return;
>      }
> @@ -3982,6 +3983,7 @@ void vnc_display_open(const char *id, Error **errp)
>      }
>
>      if (con != vd->dcl.con) {
> +        fprintf(stderr, "%s: %s\n", __func__, id);

I suppose the 2 printf are not intentional.

>          unregister_displaychangelistener(&vd->dcl);
>          vd->dcl.con = con;
>          register_displaychangelistener(&vd->dcl);
> --
> 2.9.3
>
>

without the printf,
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Patch
diff mbox series

diff --git a/ui/console.c b/ui/console.c
index eca854cbd5..c4c95abed7 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1471,6 +1471,7 @@  void unregister_displaychangelistener(DisplayChangeListener *dcl)
         dcl->con->dcls--;
     }
     QLIST_REMOVE(dcl, next);
+    dcl->ds = NULL;
     gui_setup_refresh(ds);
 }
 
diff --git a/ui/vnc.c b/ui/vnc.c
index 9f8d5a1b1f..bd46f11fcc 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3044,6 +3044,7 @@  void vnc_display_init(const char *id)
 {
     VncDisplay *vd;
 
+    fprintf(stderr, "%s: %s\n", __func__, id);
     if (vnc_display_find(id) != NULL) {
         return;
     }
@@ -3982,6 +3983,7 @@  void vnc_display_open(const char *id, Error **errp)
     }
 
     if (con != vd->dcl.con) {
+        fprintf(stderr, "%s: %s\n", __func__, id);
         unregister_displaychangelistener(&vd->dcl);
         vd->dcl.con = con;
         register_displaychangelistener(&vd->dcl);