[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libusb-devel
Subject:    Re: [libusb] NULL indicating default context in libusb_get_device_list() segfaults in 1.0.25
From:       Adam_Sjøgren via libusb-devel <libusb-devel () lists ! sourceforge ! n
Date:       2022-02-26 20:32:02
Message-ID: 87mtid74jh.fsf () tullinup ! koldfront ! dk
[Download RAW message or body]

Nathan writes:

> You initialized a non-default context then tried to use the default
> one. It only exists is you call libusb_init(NULL).
>
> In older versions the default context was always initialized but to
> use it you were always supposed to explicitly initialized it. It was a
> bug that three code in question ever worked.

Ahh, thanks for the explanation; I should consistently use NULL _or_ a
specific context, not mixing them. That makes sense.

Unfortunately I haven't noted down where I got the skeleton code I
started from, so I can't follow up there, but I have fixed by own code.

Thanks!

Would it make sense to look into detecting this condition with an
assert() or otherwise reporting it to the user? Maybe I'm the only one
making this mistake :-)


  Best regards,

    Adam

-- 
 "Although, in a sense, recognizing them as ancient         Adam Sjøgren
  might not necessarily be wrong, it's indeed          asjo@koldfront.dk
  useless."



_______________________________________________
libusb-devel mailing list
libusb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic