Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006355 [JEDI VCL] 00 JVCL Components crash always 2014-11-15 05:46 2015-09-21 17:47
Reporter DavidVTaylor View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version 3.47
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:

  HidLoadCount: Integer = 0; <- Added

function LoadHid: Boolean;
  Inc(HidLoadCount); <- Added
  if HidLoadCount > 1 then <- Added
    Exit; <- Added
  Result := LoadModule(HidLib, HidModuleName);

procedure UnloadHid;
  Dec(HidLoadCount); <- Added
  if HidLoadCount > 0 then <- Added
    Exit; <- Added

Tags No tags attached.
Attached Files ? file icon Hid.pas [^] (118,850 bytes) 2014-11-15 05:46

- Relationships

There are no notes attached to this issue.

- Issue History
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

Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker