cec: fixed crash on exit in LibCecSharp
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 6 Feb 2012 13:04:04 +0000 (14:04 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 6 Feb 2012 13:04:04 +0000 (14:04 +0100)
src/LibCecSharp/LibCecSharp.cpp

index 6b1ba7a10dc7c881386fa34e2b129fb9b7e1a41f..06a98aaedda1fa16c96073da03a12a51d1971589 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the libCEC(R) library.
  *
- * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
  * libCEC(R) is an original work, containing original code.
  *
  * libCEC(R) is a trademark of Pulse-Eight Limited.
@@ -588,7 +588,7 @@ public:
    
    ~LibCecSharp(void)
    {
-     CECDestroy(m_libCec);
+     Close();
      DestroyDelegates();
      m_libCec = NULL;
    }
@@ -596,7 +596,7 @@ public:
 protected:
    !LibCecSharp(void)
    {
-     CECDestroy(m_libCec);
+     Close();
      DestroyDelegates();
      m_libCec = NULL;
    }
@@ -950,6 +950,8 @@ public:
 private:
   void DestroyDelegates()
   {
+    m_bHasCallbacks = false;
+    delete m_callbacks;
     m_logMessageGCHandle.Free();
     m_keypressGCHandle.Free();
     m_commandGCHandle.Free();