Re: [spice-gtk 2/9] widget: Do not mix function linkage

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

 




----- Original Message -----
> > 
> > Hi
> > 
> > On Wed, Jun 8, 2016 at 1:10 PM, Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
> > > This prevents a possible crash on windows 32 bit.
> > > The linkage of UnhookWindowsHookEx is WINAPI which is __stdcall while
> > > callback for g_clear_pointer is C. This could cause stack pointer
> > > corruption depending on compiler flags.
> > >
> > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> > 
> > Reviewed-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> > 
> 
> Though this was simple enough to get an ack/nack...
> 
> Should I extend the comment to explain the background?

feel free to do it, I would be more interested to find/know a way to avoid such errors in the first place.

> Frediano
> 
> > 
> > > ---
> > >  src/spice-widget.c | 6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > > index b5936bc..c528614 100644
> > > --- a/src/spice-widget.c
> > > +++ b/src/spice-widget.c
> > > @@ -827,7 +827,11 @@ static void try_keyboard_ungrab(SpiceDisplay
> > > *display)
> > >      SPICE_DEBUG("ungrab keyboard");
> > >      gdk_keyboard_ungrab(GDK_CURRENT_TIME);
> > >  #ifdef G_OS_WIN32
> > > -    g_clear_pointer(&d->keyboard_hook, UnhookWindowsHookEx);
> > > +    // do not use g_clear_pointer as Windows API have different linkage
> > > +    if (d->keyboard_hook) {
> > > +        UnhookWindowsHookEx(d->keyboard_hook);
> > > +        d->keyboard_hook = NULL;
> > > +    }
> > >  #endif
> > >      d->keyboard_grab_active = false;
> > >      g_signal_emit(widget, signals[SPICE_DISPLAY_KEYBOARD_GRAB], 0,
> > >      false);
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]