summaryrefslogtreecommitdiff
path: root/extra/qt4/declarative-fix-sigbus.patch
blob: 0d446fce553bf22fa9e9d3d208a270bbf0178756 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- qt-everywhere-opensource-src-4.8.0.orig/src/declarative/qml/qdeclarativevmemetaobject.cpp	2012-02-04 21:23:56.573395948 +0100
+++ qt-everywhere-opensource-src-4.8.0/src/declarative/qml/qdeclarativevmemetaobject.cpp	2012-02-04 23:32:44.900073230 +0100
@@ -39,6 +39,7 @@
 **
 ****************************************************************************/
 
+#include <cstring>
 #include "private/qdeclarativevmemetaobject_p.h"
 
 #include "qdeclarative.h"
@@ -191,10 +192,12 @@
 
 double QDeclarativeVMEVariant::asDouble() 
 {
+    double result;
     if (type != QMetaType::Double)
         setValue(double(0));
 
-    return *(double *)(dataPtr());
+    std::memcpy(&result, (double *)(dataPtr()), sizeof(result));
+    return result;
 }
 
 const QString &QDeclarativeVMEVariant::asQString() 
@@ -298,7 +301,7 @@
         cleanup();
         type = QMetaType::Double;
     }
-    *(double *)(dataPtr()) = v;
+    std::memcpy((double *)(dataPtr()), &v, sizeof(v));
 }
 
 void QDeclarativeVMEVariant::setValue(const QString &v)