Re: Memory fault when inserting QTableItem into QTable

Richard Dale <[email protected]>
Newsgroups gmane.comp.kde.devel.perl
Organization Lost HIghway
Message-ID <[email protected]>
On Monday 30 August 2004 14:46, Richard Dale wrote:
> > So for me this patch (0.2) solves my problem. As far as I understood the
> >   ongoing conversation after Richards 0.2er patch this patch isn't as
> > "stable" as one could wish.
>
> I've had a look at the 0.2 patch, and its got some 'random' stuff in there
> that isn't to do with adding the dispose() method, so I would be careful
> about using it. Here is a cleaned up version without any of the unwanted
> 'zombie' changes or anything else.
Oops, the were a couple of zombie lines still left in there - here's another 
go..

-- Richard

_______________________________________________
Kde-perl mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-perl
perlqtdispose_0.5.patch (text/x-diff, 1.6 KB)
diff -Naur -X /home/duke/bin/patcher.exclude PerlQt/Qt.pm temp/Qt.pm
--- PerlQt/Qt.pm	2003-09-09 03:57:11.000000000 +0100
+++ temp/Qt.pm	2004-07-12 06:11:09.000000000 +0100
@@ -1108,4 +1108,17 @@
     return 1
 }
 
+sub Qt::base::dispose 
+{ 
+    package Qt::_internal;
+	Qt::_internal::dispose(this());
+	return;
+}
+
+sub Qt::base::isDisposed 
+{ 
+    package Qt::_internal;
+	return Qt::_internal::isDisposed(this());
+}
+
 1;
diff -Naur -X /home/duke/bin/patcher.exclude PerlQt/Qt.xs temp/Qt.xs
--- PerlQt/Qt.xs	2003-09-09 09:41:25.000000000 +0100
+++ temp/Qt.xs	2004-07-12 06:11:09.000000000 +0100
@@ -1743,6 +1743,43 @@
     delete qobj;
 
 void
+dispose(obj)
+    SV *obj
+    CODE:
+    smokeperl_object *o = sv_obj_info(obj);
+    if(!o || !o->ptr) { 
+		XSRETURN_EMPTY;
+	} else {
+		const char *className = o->smoke->classes[o->classId].className;
+		char *methodName = new char[strlen(className) + 2];
+		methodName[0] = '~';
+		strcpy(methodName + 1, className);
+		Smoke::Index nameId = o->smoke->idMethodName(methodName);
+		Smoke::Index meth = o->smoke->findMethod(o->classId, nameId);
+		if(meth > 0) {
+			Smoke::Method &m = o->smoke->methods[o->smoke->methodMaps[meth].method];
+			Smoke::ClassFn fn = o->smoke->classes[m.classId].classFn;
+			Smoke::StackItem i[1];
+			(*fn)(m.method, o->ptr, i);
+		}
+		delete[] methodName;
+		o->allocated = false;
+	}
+
+bool
+isDisposed(obj)
+    SV *obj
+    CODE:
+    smokeperl_object *o = sv_obj_info(obj);
+    if(!o) { 
+		RETVAL = 0; 
+	} else {
+		RETVAL = 1;
+	}
+    OUTPUT:
+    RETVAL
+
+void
 mapObject(obj)
     SV *obj
     CODE:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.