]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mediactrl_wmp10.cpp
don't try to access empty wxIconBundle in gtk_frame_realized_callback
[wxWidgets.git] / src / msw / mediactrl_wmp10.cpp
index 2dc26fdbdf6cfb1646eaa33d400f91345c375150..8a6f69a29d1b27766520541b7b852c808621df59 100644 (file)
@@ -50,7 +50,7 @@
 #pragma hdrstop
 #endif
 
-#if wxUSE_MEDIACTRL
+#if wxUSE_MEDIACTRL && wxUSE_ACTIVEX
 
 #include "wx/mediactrl.h"
 
@@ -675,6 +675,7 @@ public:
     wxSize m_bestSize;              // Actual movie size
 
     bool m_bWasStateChanged;        // See the "introduction"
+    wxEvtHandler* m_evthandler;
 
     friend class wxWMP10MediaEvtHandler;
     DECLARE_DYNAMIC_CLASS(wxWMP10MediaBackend)
@@ -726,6 +727,7 @@ wxWMP10MediaBackend::wxWMP10MediaBackend()
                 m_pWMPPlayer(NULL)
 
 {
+    m_evthandler = NULL;
 }
 
 //---------------------------------------------------------------------------
@@ -739,7 +741,11 @@ wxWMP10MediaBackend::~wxWMP10MediaBackend()
         m_pAX->DissociateHandle();
         delete m_pAX;
 
-        m_ctrl->PopEventHandler(true);
+        if (m_evthandler)
+        {
+            m_ctrl->RemoveEventHandler(m_evthandler);
+            delete m_evthandler;
+        }
 #else
         AtlAxWinTerm();
         _Module.Term();
@@ -812,7 +818,8 @@ bool wxWMP10MediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
     m_pAX = new wxActiveXContainer(ctrl, IID_IWMPPlayer, m_pWMPPlayer);
 
     // Connect for events
-    m_ctrl->PushEventHandler(new wxWMP10MediaEvtHandler(this));
+    m_evthandler = new wxWMP10MediaEvtHandler(this);
+    m_ctrl->PushEventHandler(m_evthandler);
 #else
     _Module.Init(NULL, ::GetModuleHandle(NULL));
     AtlAxWinInit();
@@ -1509,4 +1516,4 @@ bool MyApp::OnInit()
 
 #endif // WMP mobile 9 hacks
 
-#endif // wxUSE_MEDIACTRL
+#endif // wxUSE_MEDIACTRL && wxUSE_ACTIVEX