[vlc-devel] [PATCH] skins2: os2: save and restore FPU cw

KO Myung-Hun komh78 at gmail.com
Wed Sep 10 10:00:49 CEST 2014


WinCreateMsgQueue() changes FPU cw but does not restore it. This causes
SIGFPE later.
---
 modules/gui/skins2/os2/os2_factory.cpp |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/modules/gui/skins2/os2/os2_factory.cpp b/modules/gui/skins2/os2/os2_factory.cpp
index 61170eb..2cbfb85 100644
--- a/modules/gui/skins2/os2/os2_factory.cpp
+++ b/modules/gui/skins2/os2/os2_factory.cpp
@@ -31,6 +31,7 @@
 #include <io.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <cfloat>
 
 #include "os2_factory.hpp"
 #include "os2_graphics.hpp"
@@ -169,8 +170,16 @@ bool OS2Factory::init()
     MorphToPM();
 
     m_hab = WinInitialize( 0 );
+
+    // save FPU CW
+    unsigned saved_cw = _control87( 0, 0 );
+
+    // WinCreateMsgQueue() changes FPU CW but does not restore it
     m_hmq = WinCreateMsgQueue( m_hab, 0 );
 
+    // restore FPU CW
+    _control87( saved_cw, MCW_EM | MCW_IC | MCW_RC | MCW_PC );
+
     if( !WinRegisterClass( m_hab, vlc_class, OS2Factory::OS2Proc,
                            CS_SIZEREDRAW, sizeof( PVOID )))
     {
-- 
1.7.3.2




More information about the vlc-devel mailing list