[Kde-bindings] playground/bindings/kimono

Richard Dale Richard_Dale at tipitina.demon.co.uk
Thu Mar 22 16:58:56 UTC 2007


SVN commit 645451 by rdale:

* Hmm, a fix for a GCHandle leak stopped custom slots from working for
  no apparent reason.

CCMAIL: kde-bindings at kde.org



 M  +2 -0      ChangeLog  
 M  +4 -4      SmokeInvocation.cs  
 M  +4 -3      handlers.cpp  
 M  +11 -9     qyoto.cpp  


--- trunk/playground/bindings/kimono/ChangeLog #645450:645451
@@ -2,6 +2,8 @@
 
 	* Added debug methods for logging GCHandle.Alloc() and Free() calls
 	* Freed GCHandles in a few places, but there are still a lot of leaks
+	* Hmm, a fix for a GCHandle leak stopped custom slots from working for
+	  no apparent reason.
 
 2007-03-21  Arno Rehn  <arno at arnorehn.de>
 
--- trunk/playground/bindings/kimono/SmokeInvocation.cs #645450:645451
@@ -199,7 +199,7 @@
 					} else if (parameters[i].ParameterType == typeof(double)) {
 						args[i] = stackPtr[i].s_double;
 					} else if (parameters[i].ParameterType == typeof(string)) {
-						if (stackPtr[0].s_class != IntPtr.Zero) {
+						if (stackPtr[i].s_class != IntPtr.Zero) {
 							args[i] = (string) ((GCHandle) stackPtr[i].s_class).Target;
 #if DEBUG
 							DebugGCHandle.Free((GCHandle) stackPtr[i].s_class);
@@ -208,7 +208,7 @@
 #endif
 						}
 					} else {
-						if (stackPtr[0].s_class != IntPtr.Zero) {
+						if (stackPtr[i].s_class != IntPtr.Zero) {
 							args[i] = ((GCHandle) stackPtr[i].s_class).Target;
 #if DEBUG
 							DebugGCHandle.Free((GCHandle) stackPtr[i].s_class);
@@ -318,7 +318,7 @@
 					} else if (parameters[i].ParameterType == typeof(double)) {
 						args[i] = stackPtr[i].s_double;
 					} else if (parameters[i].ParameterType == typeof(string)) {
-						if (stackPtr[0].s_class != IntPtr.Zero) {
+						if (stackPtr[i].s_class != IntPtr.Zero) {
 							args[i] = (string) ((GCHandle) stackPtr[i].s_class).Target;
 #if DEBUG
 							DebugGCHandle.Free((GCHandle) stackPtr[i].s_class);
@@ -327,7 +327,7 @@
 #endif
 						}
 					} else {
-						if (stackPtr[0].s_class != IntPtr.Zero) {
+						if (stackPtr[i].s_class != IntPtr.Zero) {
 							args[i] = ((GCHandle) stackPtr[i].s_class).Target;
 #if DEBUG
 							DebugGCHandle.Free((GCHandle) stackPtr[i].s_class);
--- trunk/playground/bindings/kimono/handlers.cpp #645450:645451
@@ -858,8 +858,8 @@
 			m->item().s_voidp = (*IntPtrToCharStar)(m->var().s_class);
 			(*FreeGCHandle)(m->var().s_voidp);
 		}
-		break;
 	}
+	break;
 
 	case Marshall::ToObject:
 	{
@@ -875,9 +875,10 @@
 		}
 	}
 	break;
-		default:
+
+	default:
 		m->unsupported();
-	break;
+		break;
 	}
 }
 
--- trunk/playground/bindings/kimono/qyoto.cpp #645450:645451
@@ -989,6 +989,14 @@
 			signature += " const";
 		}
 
+		if (do_debug & qtdb_virtual) {
+			printf(	"virtual %p->%s::%s called\n", 
+						ptr,
+						smoke->classes[smoke->methods[method].classId].className,
+						(const char *) signature );
+			fflush(stdout);
+		}
+
 		void * obj = getPointerObject(ptr);
 		smokeqyoto_object *o = value_obj_info(obj);
 
@@ -1006,7 +1014,9 @@
 			void** _o = (void**)args[3].s_voidp;
 			
 			args[0].s_int = qt_metacall(obj, _c, _id, _o);
-			(*FreeGCHandle)(obj);
+
+			// This line stops custom slots from working - how can that be?
+//			(*FreeGCHandle)(obj);
 			return true;
 		}
 		
@@ -1016,14 +1026,6 @@
 			return false;
 		}
 
-		if (do_debug & qtdb_virtual) {
-			printf(	"virtual %p->%s::%s called\n", 
-						ptr,
-						smoke->classes[smoke->methods[method].classId].className,
-						(const char *) signature );
-			fflush(stdout);
-		}
-
 		VirtualMethodCall c(smoke, method, args, obj, overridenMethod);
 		c.next();
 		return true;



More information about the Kde-bindings mailing list