[Kde-bindings] KDE/kdebindings/csharp/qyoto
Arno Rehn
kde at arnorehn.de
Sun Nov 30 21:42:30 UTC 2008
SVN commit 891005 by arnorehn:
* Check for return values being null and if so, don't alloc a GCHandle to it.
Fixes crashes when a virtual method returned null. Thanks to Eric Butler for
reporting the bug.
CCMAIL: kde-bindings at kde.org
CCMAIL: eric at extremeboredom.net
M +6 -0 ChangeLog
M +6 -2 src/SmokeInvocation.cs
M +2 -2 src/SmokeMarshallers.cs
--- trunk/KDE/kdebindings/csharp/qyoto/ChangeLog #891004:891005
@@ -1,3 +1,9 @@
+2008-11-30 Arno Rehn <arno at arnorehn.de>
+
+ * Check for return values being null and if so, don't alloc a GCHandle to it.
+ Fixes crashes when a virtual method returned null. Thanks to Eric Butler for
+ reporting the bug.
+
2008-11-28 Richard Dale <richard.j.dale at gmail.com>
* Add missing implicit QVariant constructors for QDate and QTime
--- trunk/KDE/kdebindings/csharp/qyoto/src/SmokeInvocation.cs #891004:891005
@@ -246,6 +246,8 @@
#else
stackPtr[0].s_class = (IntPtr) GCHandle.Alloc(returnValue);
#endif
+ } else if (returnValue == null) {
+ stackPtr[0].s_class = IntPtr.Zero;
} else {
#if DEBUG
stackPtr[0].s_class = (IntPtr) DebugGCHandle.Alloc(returnValue);
@@ -356,6 +358,8 @@
#else
retval[0].s_class = (IntPtr) GCHandle.Alloc(returnValue);
#endif
+ } else if (returnValue == null) {
+ retval[0].s_class = IntPtr.Zero;
} else {
#if DEBUG
retval[0].s_class = (IntPtr) DebugGCHandle.Alloc(returnValue);
@@ -546,7 +550,7 @@
for (int i = 0, k = 1; i < args.Length; i += 2, k++) {
if (args[i+1] == null) {
unsafe {
- stack[k].s_class = (IntPtr) 0;
+ stack[k].s_class = IntPtr.Zero;
}
} else if (args[i] == typeof(int) || ((Type) args[i]).IsEnum) {
stack[k].s_int = (int) args[i+1];
@@ -628,7 +632,7 @@
} else if (returnType == typeof(char)) {
returnValue = (char) stack[0].s_char;
} else {
- if (((IntPtr) stack[0].s_class) == (IntPtr) 0) {
+ if (((IntPtr) stack[0].s_class) == IntPtr.Zero) {
returnValue = null;
} else {
returnValue = ((GCHandle) stack[0].s_class).Target;
--- trunk/KDE/kdebindings/csharp/qyoto/src/SmokeMarshallers.cs #891004:891005
@@ -252,8 +252,8 @@
}
public static IntPtr GetSmokeObject(IntPtr instancePtr) {
- if (((int) instancePtr) == 0) {
- return (IntPtr) 0;
+ if (instancePtr == IntPtr.Zero) {
+ return IntPtr.Zero;
}
Object instance = ((GCHandle) instancePtr).Target;
More information about the Kde-bindings
mailing list