[Kde-bindings] playground/bindings/kimono

Arno Rehn kde at arnorehn.de
Fri Feb 9 17:07:31 UTC 2007


SVN commit 631977 by arnorehn:

* When a qApp instance was destroyed, it would automatically destroy all
  other Qt objects, in some cases our own destructor calls could interfere
  with this mechanism. Fixed by checking if qApp == 0 and if so skipping
  the destructor calls.

CCMAIL: kde-bindings at kde.org



 M  +7 -0      ChangeLog  
 M  +6 -3      qyoto.cpp  


--- trunk/playground/bindings/kimono/ChangeLog #631976:631977
@@ -1,3 +1,10 @@
+2007-02-09  Arno Rehn  <arno at arnorehn.de>
+
+	* When a qApp instance was destroyed, it would automatically destroy all
+	  other Qt objects, in some cases our own destructor calls could interfere
+	  with this mechanism. Fixed by checking if qApp == 0 and if so skipping
+	  the destructor calls.
+
 2007-02-09  Richard Dale  <rdale at foton.es>
 
 	* Renamed CreateStrongReference() as IsInstanceContained()
--- trunk/playground/bindings/kimono/qyoto.cpp #631976:631977
@@ -543,11 +543,14 @@
 		// constructor?
 		_ctor = (strcmp(_smoke->methodNames[_tmp.name], _smoke->className(_tmp.classId)) == 0);
 		
-		// We have to check here, if our target does still exist
+		// We have to check here, if our target does still exists.
 		// If there is no entry in the weakRef Dictionary, the instance doesn't exist anymore.
 		// There's also no entry, if the method is a constructor or the method is static.
-		// If the target doesn't exist anymore, set _called to true so the method won't be invoked
-		if ((getPointerObject(_current_object) == 0) && !_ctor && !(_tmp.flags == Smoke::mf_static))
+		// If the target doesn't exist anymore, set _called to true so the method won't be invoked.
+		// The other possibility is that the qApp was just destroyed and we want to call a destructor.
+		// This could lead to a crash when we interfere with the destroying mechanism of Q(Core)Application.
+		if ( ((getPointerObject(_current_object) == 0) && !_ctor && !(_tmp.flags & Smoke::mf_static))
+			|| ((_tmp.flags & Smoke::mf_dtor) && (qApp == 0)) )
 			_called = true;
     }
 



More information about the Kde-bindings mailing list