[Kde-bindings] KDE/kdebindings/ruby/qtruby

Richard Dale Richard_Dale at tipitina.demon.co.uk
Tue Jun 23 10:11:56 UTC 2009


SVN commit 985628 by rdale:

* In smokeruby_mark() layouts owned by QWidgets or QGraphicsWidgets are 
  now marked. Items owned by QLayouts or QGraphicsLayouts are also marked.
  This fixes some premature garbage collection problems in Plasma Applets,
  reported by David Palacio.

CCMAIL: kde-bindings at kde.org



 M  +6 -0      ChangeLog  
 M  +41 -0     src/handlers.cpp  


--- trunk/KDE/kdebindings/ruby/qtruby/ChangeLog #985627:985628
@@ -1,3 +1,9 @@
+2009-06-23  Richard Dale  <richard.j.dale at gmail.com>
+	* In smokeruby_mark() layouts owned by QWidgets or QGraphicsWidgets are 
+	  now marked. Items owned by QLayouts or QGraphicsLayouts are also marked.
+	  This fixes some premature garbage collection problems in Plasma Applets,
+	  reported by David Palacio.
+
 2009-06-18  Richard Dale  <richard.j.dale at gmail.com>
 	* Made Qt::ItemSelection Enumerable
 
--- trunk/KDE/kdebindings/ruby/qtruby/src/handlers.cpp #985627:985628
@@ -44,7 +44,9 @@
 
 #if QT_VERSION >= 0x40200
 #include <QtGui/qgraphicsitem.h>
+#include <QtGui/qgraphicslayout.h>
 #include <QtGui/qgraphicsscene.h>
+#include <QtGui/qgraphicswidget.h>
 #include <QtGui/qstandarditemmodel.h>
 #include <QtGui/qundostack.h>
 #endif
@@ -204,6 +206,18 @@
 			}
 		}
 
+		if (o->smoke->isDerivedFromByName(className, "QWidget")) {
+			QWidget * widget = (QWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QWidget").index);
+			QLayout * layout = widget->layout();
+			if (layout != 0) {
+				obj = getPointerObject(layout);
+				if (obj != Qnil) {
+					if (do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", "QLayout", layout, (void*)obj);
+					rb_gc_mark(obj);
+				}
+			}
+		}
+
 		if (o->smoke->isDerivedFromByName(className, "QListWidget")) {
 			QListWidget * listwidget = (QListWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QListWidget").index);
 			
@@ -285,6 +299,33 @@
 			return;
 		}
 
+		if (o->smoke->isDerivedFromByName(className, "QGraphicsWidget")) {
+			QGraphicsWidget * widget = (QGraphicsWidget *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QGraphicsWidget").index);
+			QGraphicsLayout * layout = widget->layout();
+			if (layout != 0) {
+				obj = getPointerObject(layout);
+				if (obj != Qnil) {
+					if (do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", "QGraphicsLayout", layout, (void*)obj);
+					rb_gc_mark(obj);
+				}
+			}
+		}
+
+		if (o->smoke->isDerivedFromByName(className, "QGraphicsLayout")) {
+			QGraphicsLayout * qlayout = (QGraphicsLayout *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QGraphicsLayout").index);
+			for (int i = 0; i < qlayout->count(); ++i) {
+				QGraphicsLayoutItem * item = qlayout->itemAt(i);
+				if (item != 0) {
+					obj = getPointerObject(item);
+					if (obj != Qnil) {
+						if (do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p", "QGraphicsLayoutItem", item, (void*)obj);
+						rb_gc_mark(obj);
+					}
+				}
+			}
+			return;
+		}
+
 		if (o->smoke->isDerivedFromByName(className, "QGraphicsItem")) {
 			QGraphicsItem * item = (QGraphicsItem *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QGraphicsItem").index);
 			// Only mark the QGraphicsItem tree if the current item doesn't have a parent.



More information about the Kde-bindings mailing list