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.
1.1 --- a/HidDevice.cpp Thu Jul 10 22:05:18 2014 +0200
1.2 +++ b/HidDevice.cpp Sat Jul 12 13:15:31 2014 +0200
1.3 @@ -17,6 +17,14 @@
1.4
1.5 /**
1.6 */
1.7 +HidDevice::~HidDevice()
1.8 + {
1.9 + Close();
1.10 + }
1.11 +
1.12 +
1.13 +/**
1.14 +*/
1.15 int HidDevice::Open(const char* aPath)
1.16 {
1.17 Close();
1.18 @@ -55,10 +63,11 @@
1.19 }
1.20
1.21 /**
1.22 +Close this HID device
1.23 */
1.24 void HidDevice::Close()
1.25 {
1.26 - hid_close(iHidDevice);
1.27 + hid_close(iHidDevice); //No effect if device is null
1.28 iHidDevice=NULL;
1.29 //
1.30 memset(iVendor,0,sizeof(iVendor));
2.1 --- a/HidDevice.h Thu Jul 10 22:05:18 2014 +0200
2.2 +++ b/HidDevice.h Sat Jul 12 13:15:31 2014 +0200
2.3 @@ -17,6 +17,8 @@
2.4 {
2.5 public:
2.6 HidDevice();
2.7 + virtual ~HidDevice();
2.8 + //
2.9 int Open(const char* aPath);
2.10 int Open(unsigned short aVendorId, unsigned short aProductId, const wchar_t* aSerialNumber);
2.11 void Close();
3.1 --- a/MiniDisplay.cpp Thu Jul 10 22:05:18 2014 +0200
3.2 +++ b/MiniDisplay.cpp Sat Jul 12 13:15:31 2014 +0200
3.3 @@ -23,8 +23,7 @@
3.4
3.5 void MiniDisplayClose(MiniDisplayDevice aDevice)
3.6 {
3.7 - delete aDevice;
3.8 - //device = NULL;
3.9 + delete ((GP1212A01A*)aDevice);
3.10 }
3.11
3.12