Commit 9aa773ce authored by Damien Fouilleul's avatar Damien Fouilleul

- vlcshell.cpp: fix for a couple of crashing scenarios

parent 7e54e24b
...@@ -630,7 +630,12 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar ...@@ -630,7 +630,12 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex); libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
if( p_input ) if( p_input )
{ {
vlc_int64_t pos = numberValue(args[0])*1000LL; vlc_int64_t pos = 0;
if( NPVARIANT_IS_INT32(args[0]) )
pos = (vlc_int64_t)NPVARIANT_TO_INT32(args[0]);
else
pos = (vlc_int64_t)NPVARIANT_TO_DOUBLE(args[0]);
if( NPVARIANT_TO_BOOLEAN(args[1]) ) if( NPVARIANT_TO_BOOLEAN(args[1]) )
{ {
/* relative seek */ /* relative seek */
...@@ -649,7 +654,6 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar ...@@ -649,7 +654,6 @@ RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *ar
libvlc_input_free(p_input); libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
libvlc_input_free(p_input);
NPN_SetException(this, libvlc_exception_get_message(&ex)); NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex); libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR; return INVOKERESULT_GENERIC_ERROR;
......
...@@ -276,6 +276,16 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save ) ...@@ -276,6 +276,16 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata); VlcPlugin* p_plugin = reinterpret_cast<VlcPlugin*>(instance->pdata);
#if XP_WIN
HWND win = (HWND)p_plugin->getWindow()->window;
WNDPROC winproc = p_plugin->getWindowProc();
if( winproc )
{
/* reset WNDPROC */
SetWindowLong( win, GWL_WNDPROC, (LONG)winproc );
}
#endif
if( p_plugin ) if( p_plugin )
delete p_plugin; delete p_plugin;
...@@ -361,13 +371,13 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window ) ...@@ -361,13 +371,13 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
/* reset WNDPROC */ /* reset WNDPROC */
SetWindowLong( oldwin, GWL_WNDPROC, (LONG)oldproc ); SetWindowLong( oldwin, GWL_WNDPROC, (LONG)oldproc );
} }
/* attach our plugin object */
SetWindowLongPtr((HWND)drawable, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(p_plugin));
/* install our WNDPROC */ /* install our WNDPROC */
p_plugin->setWindowProc( (WNDPROC)SetWindowLong( drawable, p_plugin->setWindowProc( (WNDPROC)SetWindowLong( drawable,
GWL_WNDPROC, (LONG)Manage ) ); GWL_WNDPROC, (LONG)Manage ) );
/* attach our plugin object */
SetWindowLongPtr((HWND)drawable, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(p_plugin));
/* change window style to our liking */ /* change window style to our liking */
LONG style = GetWindowLong((HWND)drawable, GWL_STYLE); LONG style = GetWindowLong((HWND)drawable, GWL_STYLE);
style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS; style |= WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment