[Spice-devel,spice-gtk,v1,4/5] win-usb-dev: Let finalize do libusb_exit()

Submitted by Victor Toso on Nov. 14, 2016, 11:26 p.m.

Details

Message ID 20161114232655.32459-4-victortoso@redhat.com
State Accepted
Commit bd530d0feeedff39fbf8cafedd011a7abc53ac01
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Victor Toso Nov. 14, 2016, 11:26 p.m.
From: Victor Toso <me@victortoso.com>

This fixes a hanging on mingw-spice-gtk when the GUdevClient fails to
initialize due problems in the UsbDk installation.

The libusb_exit() will be called on priv->ctx in
g_udev_client_initable_init() and also it will be called on NULL at
g_udev_client_finalize(), making the application hang on
initialization.

Resolves: https://bugs.freedesktop.org/show_bug.cgi?id=98686
Signed-off-by: Victor Toso <victortoso@redhat.com>
---
 src/win-usb-dev.c | 3 ---
 1 file changed, 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/win-usb-dev.c b/src/win-usb-dev.c
index 4b95b2d..5e5bb4d 100644
--- a/src/win-usb-dev.c
+++ b/src/win-usb-dev.c
@@ -232,9 +232,6 @@  g_udev_client_initable_init(GInitable *initable, GCancellable *cancellable,
  g_udev_client_init_failed_unreg:
     UnregisterClass(G_UDEV_CLIENT_WINCLASS_NAME, NULL);
  g_udev_client_init_failed:
-    libusb_exit(priv->ctx);
-    priv->ctx = NULL;
-
     return FALSE;
 }
 

Comments

On Tue, Nov 15, 2016 at 12:26:54AM +0100, Victor Toso wrote:
> From: Victor Toso <me@victortoso.com>
> 
> This fixes a hanging on mingw-spice-gtk when the GUdevClient fails to
> initialize due problems in the UsbDk installation.

"This fixes a hang in mingw-spice-gtk ... due to problems ..."
I'd change the shortlog to _finalize() or finalize() so that it's clear
that it's a method name.

> 
> The libusb_exit() will be called on priv->ctx in
> g_udev_client_initable_init() and also it will be called on NULL at
> g_udev_client_finalize(), making the application hang on
> initialization.

On initialization? Is this because g_udev_client_finalize() is going to
get called when g_udev_client_initable_init() fails?

Acked-by: Christophe Fergeau <cfergeau@redhat.com>


Christophe
On Tue, Nov 15, 2016 at 12:06:02PM +0100, Christophe Fergeau wrote:
> On Tue, Nov 15, 2016 at 12:26:54AM +0100, Victor Toso wrote:
> > From: Victor Toso <me@victortoso.com>
> > 
> > This fixes a hanging on mingw-spice-gtk when the GUdevClient fails to
> > initialize due problems in the UsbDk installation.
> 
> "This fixes a hang in mingw-spice-gtk ... due to problems ..."
> I'd change the shortlog to _finalize() or finalize() so that it's clear
> that it's a method name.

Ok, I'll fix it

>
> >
> > The libusb_exit() will be called on priv->ctx in
> > g_udev_client_initable_init() and also it will be called on NULL at
> > g_udev_client_finalize(), making the application hang on
> > initialization.
>
> On initialization? Is this because g_udev_client_finalize() is going to
> get called when g_udev_client_initable_init() fails?

Yes, the object is already created at g_udev_client_initable_init() so
when it fails it calls _finalize()

I'll send a v2 for this one as is the most interesting patch in this
batch for me.

>
> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
>
>
> Christophe

Cheers,
    toso