View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006355 | JEDI VCL | 00 JVCL Components | public | 2014-11-15 05:46 | 2015-09-21 17:47 |
Reporter | DavidVTaylor | Assigned To | obones | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.47 | ||||
Target Version | Fixed in Version | 3.49 | |||
Summary | 0006355: TJvHidDeviceController crash due to premature DLL unloading | ||||
Description | Using multiple instance of the Hid Controller component in application results in an AV on shutdown: Access violation at address 00000000. Read of address 00000000. The AV occurs because TJvHidDeviceController.Destroy calls UnloadHid which causes the HID library to be prematurely unloaded. The first instance of the HID component unloads the DLL and the second instance crashes since the DLL procedure pointers have been invalidated. | ||||
Additional Information | The solution to the problem was to add a counter to track calls to LoadHid/UnloadHid similar to the way LoadSetupApi/UnloadSetupApi works. The attached Hid.pas file implements this change and resolves the AV problem when using multiple HID components. Below are the changes made to the code: var HidLib: TModuleHandle = INVALID_MODULEHANDLE_VALUE; HidLoadCount: Integer = 0; <- Added function LoadHid: Boolean; begin {$IFDEF HID_LINKONREQUEST} Inc(HidLoadCount); <- Added if HidLoadCount > 1 then <- Added Exit; <- Added Result := LoadModule(HidLib, HidModuleName); procedure UnloadHid; begin {$IFDEF HID_LINKONREQUEST} Dec(HidLoadCount); <- Added if HidLoadCount > 0 then <- Added Exit; <- Added UnloadModule(HidLib); | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2014-11-15 05:46 | DavidVTaylor | New Issue | |
2014-11-15 05:46 | DavidVTaylor | File Added: Hid.pas | |
2014-12-04 15:04 | obones | Status | new => acknowledged |
2014-12-04 15:53 | obones | Status | acknowledged => resolved |
2014-12-04 15:53 | obones | Fixed in Version | => Daily / GIT |
2014-12-04 15:53 | obones | Resolution | open => fixed |
2014-12-04 15:53 | obones | Assigned To | => obones |
2015-09-21 17:47 | obones | Fixed in Version | Daily / GIT => 3.49 |