# HG changeset patch # User sl # Date 1405163731 -7200 # Node ID 8bac7aac665ca1d5ded6ace72ed6c1c977bd12c1 # Parent b1c1b2be9a1caa9cbf4085ac65429de1fa79091e Display can now be opened, closed and reopened thanks to the following fixes. Fixing issue with non-virtual destructor. Fixing issue with deletion of void pointer. diff -r b1c1b2be9a1c -r 8bac7aac665c HidDevice.cpp --- a/HidDevice.cpp Thu Jul 10 22:05:18 2014 +0200 +++ b/HidDevice.cpp Sat Jul 12 13:15:31 2014 +0200 @@ -17,6 +17,14 @@ /** */ +HidDevice::~HidDevice() + { + Close(); + } + + +/** +*/ int HidDevice::Open(const char* aPath) { Close(); @@ -55,10 +63,11 @@ } /** +Close this HID device */ void HidDevice::Close() { - hid_close(iHidDevice); + hid_close(iHidDevice); //No effect if device is null iHidDevice=NULL; // memset(iVendor,0,sizeof(iVendor)); diff -r b1c1b2be9a1c -r 8bac7aac665c HidDevice.h --- a/HidDevice.h Thu Jul 10 22:05:18 2014 +0200 +++ b/HidDevice.h Sat Jul 12 13:15:31 2014 +0200 @@ -17,6 +17,8 @@ { public: HidDevice(); + virtual ~HidDevice(); + // int Open(const char* aPath); int Open(unsigned short aVendorId, unsigned short aProductId, const wchar_t* aSerialNumber); void Close(); diff -r b1c1b2be9a1c -r 8bac7aac665c MiniDisplay.cpp --- a/MiniDisplay.cpp Thu Jul 10 22:05:18 2014 +0200 +++ b/MiniDisplay.cpp Sat Jul 12 13:15:31 2014 +0200 @@ -23,8 +23,7 @@ void MiniDisplayClose(MiniDisplayDevice aDevice) { - delete aDevice; - //device = NULL; + delete ((GP1212A01A*)aDevice); }