[Spice-devel] [client v2 01/10] gdk: Temporarily ignore clipboard_get()'s deprecation warnings

Jonathon Jongsma jjongsma at redhat.com
Fri Oct 21 16:48:04 UTC 2016


On Fri, 2016-10-21 at 15:41 +0200, Francois Gouget wrote:
> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> ---
> 
> Of course a better solution would be to figure out whether this is
> still 
> needed, whether this executes in the main thread or not, etc.
> 
>  src/spice-gtk-session.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> index 7bed005..7ec2a57 100644
> --- a/src/spice-gtk-session.c
> +++ b/src/spice-gtk-session.c
> @@ -810,9 +810,11 @@ static void clipboard_get(GtkClipboard
> *clipboard,
>  
>      /* apparently, this is needed to avoid dead-lock, from
>         gtk_dialog_run */
> +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      gdk_threads_leave();
>      g_main_loop_run(ri.loop);
>      gdk_threads_enter();
> +    G_GNUC_END_IGNORE_DEPRECATIONS
>  
>  cleanup:
>      g_clear_pointer(&ri.loop, g_main_loop_unref);


So, I just now noticed that it calls _leave() first, and then _enter()
afterwards. So the first time clipboard_get() is called, it calls
_leave() without _enter() ever having been called. It turns out that
gdk handles this case by doing a g_mutex_trylock() before unlocking the
mutex, but it still seems quite strange...  

Since this code is modeled on the implementation of gtk_dialog_run(),
and that implementation also still uses these deprecated functions, I
guess I'm OK with just ignoring these deprecations for now unless
somebody else objects.

Acked-by: Jonathon Jongsma <jjongsma at redhat.com>


More information about the Spice-devel mailing list