[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [PATCH virt-viewer 10/19] Use virt_viewer_connect_object() for display



On Mon, Jul 16, 2012 at 06:57:45PM +0200, Marc-André Lureau wrote:
> When display is released, detach signal automatically

Same question as the similar patch before, why? I'm assuming that it's
because we are going to handle displays dynamically, and if we don't do
that, we'll sometimes end up with signals using dead objects?

> ---
>  src/virt-viewer-app.c    |    4 ++--
>  src/virt-viewer-window.c |   24 ++++++++++++------------
>  2 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 758cfe9..e5c674a 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -658,8 +658,8 @@ virt_viewer_app_display_added(VirtViewerSession *session G_GNUC_UNUSED,
>      }
>  
>      virt_viewer_window_set_display(window, display);
> -    g_signal_connect(display, "notify::show-hint",
> -                     G_CALLBACK(display_show_hint), window);
> +    virt_viewer_signal_connect_object(display, "notify::show-hint",
> +                                      G_CALLBACK(display_show_hint), window, 0);
>      g_object_notify(G_OBJECT(display), "show-hint"); /* call display_show_hint */
>  }
>  
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index 4887e28..3f7cbbe 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -1042,18 +1042,18 @@ virt_viewer_window_set_display(VirtViewerWindow *self, VirtViewerDisplay *displa
>          gtk_notebook_append_page(GTK_NOTEBOOK(priv->notebook), GTK_WIDGET(display), NULL);
>          gtk_widget_show_all(GTK_WIDGET(display));
>  
> -        g_signal_connect(display, "display-pointer-grab",
> -                         G_CALLBACK(virt_viewer_window_pointer_grab), self);
> -        g_signal_connect(display, "display-pointer-ungrab",
> -                         G_CALLBACK(virt_viewer_window_pointer_ungrab), self);
> -        g_signal_connect(display, "display-keyboard-grab",
> -                         G_CALLBACK(virt_viewer_window_keyboard_grab), self);
> -        g_signal_connect(display, "display-keyboard-ungrab",
> -                         G_CALLBACK(virt_viewer_window_keyboard_ungrab), self);
> -        g_signal_connect(display, "display-desktop-resize",
> -                         G_CALLBACK(virt_viewer_window_desktop_resize), self);
> -        g_signal_connect(display, "notify::show-hint",
> -                         G_CALLBACK(display_show_hint), self);
> +        virt_viewer_signal_connect_object(display, "display-pointer-grab",
> +                                          G_CALLBACK(virt_viewer_window_pointer_grab), self, 0);
> +        virt_viewer_signal_connect_object(display, "display-pointer-ungrab",
> +                                          G_CALLBACK(virt_viewer_window_pointer_ungrab), self, 0);
> +        virt_viewer_signal_connect_object(display, "display-keyboard-grab",
> +                                          G_CALLBACK(virt_viewer_window_keyboard_grab), self, 0);
> +        virt_viewer_signal_connect_object(display, "display-keyboard-ungrab",
> +                                          G_CALLBACK(virt_viewer_window_keyboard_ungrab), self, 0);
> +        virt_viewer_signal_connect_object(display, "display-desktop-resize",
> +                                          G_CALLBACK(virt_viewer_window_desktop_resize), self, 0);
> +        virt_viewer_signal_connect_object(display, "notify::show-hint",
> +                                          G_CALLBACK(display_show_hint), self, 0);
>      }
>  }
>  
> -- 
> 1.7.10.4
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list redhat com
> https://www.redhat.com/mailman/listinfo/virt-tools-list

Attachment: pgpQJGV5WGpE6.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]