Xojo Conferences
XDCMay2019MiamiUSA

[MBS] HIDAPI Crash on Device Removal (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] [ANN] 16.4pr5
Next thread: [MBS] [ANN] Save the date for MBS Xojo Conference in Berlin 2017


Re: [MBS] Popupmenu   -   Garth Hjelte
  [MBS] HIDAPI Crash on Device Removal   -   Jeremy Wood
   Re: [MBS] HIDAPI Crash on Device Removal   -   Christian Schmitz

[MBS] HIDAPI Crash on Device Removal
Date: 28.08.16 02:49 (Sat, 27 Aug 2016 18:49:01 -0700)
From: Jeremy Wood
I'm migrating an older app over from using MacHID and WinHID over to using
HIDAPI, which I've found to be more compatible—not to mention cleaner cross
platform.

Anyway, I'm seeing crashes sometimes when I remove the USB device.

It looks like something is being accessed after the handle is invalid. I've
tried to fix it at the Xojo-level by checking for errors and such, but to
no avail. This is with MBS 16.3, Xojo 15.3.

Has anybody else run into this?

Jeremy

Here's a sample (partial) crash dump (Christian, I'd be happy to send you
the full thing directly, I'm not comfortable dropping it on the web):

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008
Exception Note: EXC_CORPSE_NOTIFY

VM Regions Near 0x8:
-->
__TEXT 0000000000001000-0000000000473000 [ 4552K]
r-x/rwx SM=COW /Users/USER/*/My App Name.debug.app/Contents/MacOS/My App
Name.debug

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_pthread.dylib 0x972ce0bf pthread_mutex_lock + 12
1 com.apple.CoreFoundation 0x93a4f905 CFRunLoopStop + 53
2 MBS_HIDAPI_Plugin_18950.dylib 0x0745ff9b hid_device_removal_callback +
27
3 com.apple.framework.IOKit 0x9e48d84d __IOHIDDeviceNotification + 198
4 com.apple.framework.IOKit 0x9e46507d IODispatchCalloutFromCFMessage
+ 256
5 com.apple.CoreFoundation 0x93a1e2da __CFMachPortPerform + 330
6 com.apple.CoreFoundation 0x93a1e185
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
7 com.apple.CoreFoundation 0x93a1e0f0 __CFRunLoopDoSource1 + 512
8 com.apple.CoreFoundation 0x93a15639 __CFRunLoopRun + 2649
9 com.apple.CoreFoundation 0x93a14976 CFRunLoopRunSpecific + 390
10 com.apple.CoreFoundation 0x93a147db CFRunLoopRunInMode + 123
11 com.apple.HIToolbox 0x9538d2f1 RunCurrentEventLoopInMode + 267
12 com.apple.HIToolbox 0x9538d0f3 ReceiveNextEventCommon + 503
13 com.apple.HIToolbox 0x9538ceec
_BlockUntilNextEventMatchingListInModeWithFilter + 99
14 com.apple.AppKit 0x9abd52e2 _DPSNextEvent + 1053
15 com.apple.AppKit 0x9abd485b -[NSApplication
_nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1057
16 com.apple.AppKit 0x9abd4432 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 121
17 XojoFramework 0x00592fde 0x553000 + 262110
18 XojoFramework 0x00593044 0x553000 + 262212
19 My App Name.debug 0x0015e800 Delegate.Invoke%% + 34
20 My App Name.debug 0x000667a7
Application._CallFunctionWithExceptionHandling%%o<Application>p + 248
21 XojoFramework 0x006f5463 0x553000 + 1713251
22 XojoFramework 0x00592f6d 0x553000 + 261997
23 com.apple.AppKit 0x9abc7b47 -[NSApplication run] + 1063
24 XojoFramework 0x006f5509 0x553000 + 1713417
25 XojoFramework 0x006f3650 RuntimeRun + 49
26 My App Name.debug 0x00120fc3 REALbasic._RuntimeRun + 34
27 My App Name.debug 0x0042371e _Main + 257
28 My App Name.debug 0x00418bdb main + 36
29 My App Name.debug 0x0042ffc6 start + 53
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] HIDAPI Crash on Device Removal
Date: 28.08.16 11:07 (Sun, 28 Aug 2016 12:07:14 +0200)
From: Christian Schmitz

> Am 28.08.2016 um 03:49 schrieb Jeremy Wood <<email address removed>>:
>
> I'm migrating an older app over from using MacHID and WinHID over to using
> HIDAPI, which I've found to be more compatible—not to mention cleaner cross
> platform.

Let's see if we can fix it. I'll email you a new plugin off list.

Sincerely
Christian