[Kde-bindings] KDE/kdebindings/csharp/qyoto

Arno Rehn kde at arnorehn.de
Tue Dec 9 18:55:49 UTC 2008


SVN commit 894989 by arnorehn:

* Watch out for itemChange() calls and if necessary, add or remove global refs
  to QGraphicsItems and subclasses. Thanks to Eric Butler for reporting the bug.

CCMAIL: kde-bindings at kde.org



 M  +5 -0      ChangeLog  
 M  +26 -0     src/qyotosmokebinding.cpp  


--- trunk/KDE/kdebindings/csharp/qyoto/ChangeLog #894988:894989
@@ -1,3 +1,8 @@
+2008-12-09  Arno Rehn  <arno at arnorehn.de>
+
+	* Watch out for itemChange() calls and if necessary, add or remove global refs
+	  to QGraphicsItems and subclasses. Thanks to Eric Butler for reporting the bug.
+
 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.
--- trunk/KDE/kdebindings/csharp/qyoto/src/qyotosmokebinding.cpp #894988:894989
@@ -20,6 +20,14 @@
 
 #include <cstdlib>
 
+#include <qt_smoke.h>
+
+#if QT_VERSION >= 0x40200
+	#include <QVariant>
+	#include <QGraphicsScene>
+	#include <QGraphicsItem>
+#endif
+
 namespace Qyoto {
 
 Binding::Binding() : SmokeBinding(0) {}
@@ -92,6 +100,11 @@
 		fflush(stdout);
 	}
 
+#if QT_VERSION >= 0x40200
+	static Smoke::Index qgraphicsitem_class = qt_Smoke->idClass("QGraphicsItem").index;
+#endif
+
+	smokeqyoto_object *sqo = (smokeqyoto_object*) (*GetSmokeObject)(obj);
 	if (strcmp(signature, "qt_metacall(QMetaObject::Call, int, void**)") == 0) {
 		QMetaObject::Call _c = (QMetaObject::Call)args[1].s_int;
 		int _id = args[2].s_int;
@@ -101,6 +114,19 @@
 
 		(*FreeGCHandle)(obj);
 		return true;
+#if QT_VERSION >= 0x40200
+	} else if (strcmp(signature, "itemChange(QGraphicsItem::GraphicsItemChange, const QVariant&)") == 0
+	           && smoke->isDerivedFrom(smoke, sqo->classId, qt_Smoke, qgraphicsitem_class)) {
+		int change = args[1].s_int;
+		if (change == QGraphicsItem::ItemSceneChange) {
+			QGraphicsScene *scene = ((QVariant*) args[2].s_voidp)->value<QGraphicsScene*>();
+			if (scene) {
+				(*AddGlobalRef)(obj, ptr);
+			} else {
+				(*RemoveGlobalRef)(obj, ptr);
+			}
+		}
+#endif
 	}
 	void * overridenMethod = (*OverridenMethod)(obj, (const char *) signature);
 	if (overridenMethod == 0) {



More information about the Kde-bindings mailing list