[vlc-commits] npapi win32: added prerequisites checks to VlcPluginWin::destroy_windows

Sergey Radionov git at videolan.org
Wed Dec 21 12:54:12 CET 2011


npapi-vlc | branch: master | Sergey Radionov <RSATom at gmail.com> | Tue Dec 13 09:27:51 2011 +0700| [ab6cff7385360c46b21970687ca028e288c3edcd] | committer: Jean-Baptiste Kempf

npapi win32: added prerequisites checks to VlcPluginWin::destroy_windows

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=ab6cff7385360c46b21970687ca028e288c3edcd
---

 npapi/vlcplugin_win.cpp |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/npapi/vlcplugin_win.cpp b/npapi/vlcplugin_win.cpp
index de71019..97e50a7 100644
--- a/npapi/vlcplugin_win.cpp
+++ b/npapi/vlcplugin_win.cpp
@@ -170,11 +170,17 @@ bool VlcPluginWin::destroy_windows()
 {
     _WindowsManager.DestroyWindows();
 
-    /* reset WNDPROC */
     HWND oldwin = (HWND)npwindow.window;
-    SetWindowLongPtr( oldwin, GWLP_WNDPROC, (LONG_PTR)(getWindowProc()) );
-    setWindowProc(NULL);
+    if(oldwin){
+        WNDPROC winproc = getWindowProc();
+        if( winproc )
+        {
+            /* reset WNDPROC */
+            SetWindowLongPtr( oldwin, GWLP_WNDPROC, (LONG_PTR)winproc );
+            setWindowProc(NULL);
+        }
+        npwindow.window = NULL;
+    }
 
-    npwindow.window = NULL;
     return true;
 }



More information about the vlc-commits mailing list