View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005546 | JEDI VCL | 00 JVCL Components | public | 2011-04-06 15:08 | 2011-09-21 14:10 |
Reporter | Big Papa | Assigned To | obones | ||
Priority | normal | Severity | minor | Reproducibility | sometimes |
Status | resolved | Resolution | fixed | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in Version | 3.45 | |||
Summary | 0005546: TJvHidPnPInfo is freed twice | ||||
Description | Sometimes (if a HID device can't be opened) the TJvHidPnPInfo is freed twice. If the device can't be opened an exception is raised in the constructor of TJvHidDevice: TJvHidDevice.CtlCreate: raise EControllerError.CreateRes(@RsEDeviceCannotBeOpened); Then the destructor is called which calls free on the previously set FPnPInfo field: TJvHidDevice.Destroy: FPnPInfo.Free; The second free is called in TJvHidDeviceController.DeviceChange.FillInList after the exception is caught: TJvHidDeviceController.DeviceChange.FillInList: PnPInfo := TJvHidPnPInfo.Create(PnPHandle, DevData, PChar(@FunctionClassDeviceData.DevicePath)); // create HID device object and add it to the device list try HidDev := TJvHidDevice.CtlCreate(PnPInfo, Self); NewList.Add(HidDev); except // ignore device if unreadable but still free used memory !!!! PnPInfo.Free; end; In earlier versions the PnPInfo.Free; statement in the FillInList procedure is missing (and all works well ;)) | ||||
Tags | No tags attached. | ||||
|
I would like to vote +1 for this issue as it is causing an error for some of my users |
|
Couldn't it just be... if PnPInfo <> nil then PnPInfo.Free; |
|
Actually FreeAndNil(PnPInfo); ... might be best in both Free's to be cleaner |
|
FreeAndNill won't work because two pointers to the same class are freed (if one is set to nil the other isn't) The best practice whould be to determine which class is the owner of the pnpInfo ans so is responsible for the destruction. Because the TJvHidDevice destroys the pnpInfo I think the ownership of the pnpInfo goes from TJvHidDeviceController to the TJvHidDevice which is after the constructor call responsible for the destruction of pnpInfo. => so i just deleted the PnPInfo.Free; line in the TJvHidDeviceController.DeviceChange.FillInList function. |
|
You are right. I don't care how they fix it as long as they fix it as I have verified it has solved my users issues. |
|
Yes, this looks stupid |
|
This is now fixed in SVN |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-04-06 15:08 | Big Papa | New Issue | |
2011-04-24 16:04 | Melloware | Note Added: 0018528 | |
2011-04-24 16:09 | Melloware | Note Added: 0018529 | |
2011-04-25 13:57 | Melloware | Note Added: 0018530 | |
2011-04-27 19:23 | Big Papa | Note Added: 0018531 | |
2011-05-04 20:10 | Melloware | Note Added: 0018534 | |
2011-06-07 17:58 | obones | Note Added: 0018632 | |
2011-06-07 17:58 | obones | Status | new => acknowledged |
2011-06-08 16:10 | obones | Note Added: 0018685 | |
2011-06-08 16:10 | obones | Status | acknowledged => resolved |
2011-06-08 16:10 | obones | Fixed in Version | => Daily / SVN |
2011-06-08 16:10 | obones | Resolution | open => fixed |
2011-06-08 16:10 | obones | Assigned To | => obones |
2011-09-21 14:10 | obones | Fixed in Version | Daily / SVN => 3.45 |