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

KO Myung-Hun git at videolan.org
Sun Sep 28 16:57:47 CEST 2014


vlc/vlc-2.1 | branch: master | KO Myung-Hun <komh78 at gmail.com> | Wed Sep 10 17:00:49 2014 +0900| [b10b55eb505ebd2ad01b540386a012c074a4dd16] | committer: Jean-Baptiste Kempf

skins2: os2: save and restore FPU cw

WinCreateMsgQueue() changes FPU cw but does not restore it. This causes
SIGFPE later.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit c35f6c1be0c06204a7b9787695cfa1150c5e5f90)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/skins2/os2/os2_factory.cpp |    9 +++++++++
 1 file changed, 9 insertions(+)

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 )))
     {



More information about the vlc-commits mailing list