[Kde-bindings] branches/KDE/3.5/kdebindings/qtruby

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sun Sep 17 19:56:59 UTC 2006


SVN commit 585700 by rdale:

* Fixed bug reported by Caleb Tennis where temporary QString const arguments
  were only being deleting after marshalling if they weren't const types.

CCMAIL: kde-bindings at kde.org



 M  +5 -0      ChangeLog  
 M  +30 -28    rubylib/qtruby/handlers.cpp  


--- branches/KDE/3.5/kdebindings/qtruby/ChangeLog #585699:585700
@@ -1,3 +1,8 @@
+2006-09-17  Richard Dale  <rdale at foton.es>
+
+	* Fixed bug reported by Caleb Tennis where temporary QString const arguments
+	  were only being deleting after marshalling if they weren't const types.
+
 2006-09-14  Richard Dale  <rdale at foton.es>
 
 	* Added a new variant of connect, which takes a SIGNAL as an argument, along with
--- branches/KDE/3.5/kdebindings/qtruby/rubylib/qtruby/handlers.cpp #585699:585700
@@ -856,18 +856,18 @@
 }
 
 static void marshall_QString(Marshall *m) {
-    switch(m->action()) {
-      case Marshall::FromVALUE:
+	switch(m->action()) {
+	case Marshall::FromVALUE:
 	{
-	    QString* s = 0;
-	    if( *(m->var()) != Qnil) {
-               s = qstringFromRString(*(m->var()));
-            } else {
-                s = new QString(QString::null);
-            }
+		QString* s = 0;
+		if ( *(m->var()) != Qnil) {
+			s = qstringFromRString(*(m->var()));
+		} else {
+			s = new QString(QString::null);
+		}
 		
-	    m->item().s_voidp = s;
-	    m->next();
+		m->item().s_voidp = s;
+		m->next();
 		
 		if (!m->type().isConst() && *(m->var()) != Qnil && s != 0 && !s->isNull()) {
 			rb_str_resize(*(m->var()), 0);
@@ -875,29 +875,31 @@
 			rb_str_cat2(*(m->var()), StringValuePtr(temp));
 		}
 	    
-		if(s && m->type().isConst() && m->cleanup())
-		delete s;
+		if (s != 0 && m->cleanup()) {
+			delete s;
+		}
 	}
 	break;
-      case Marshall::ToVALUE:
+	case Marshall::ToVALUE:
 	{
-	    QString *s = (QString*)m->item().s_voidp;
-	    if(s) {
-	    	if (s->isNull()) {
-                    *(m->var()) = Qnil;
-	     	} else {
-               *(m->var()) = rstringFromQString(s);
-	     	}
-	     	if(m->cleanup() || m->type().isStack())
-	     	delete s;
-         } else {
-                *(m->var()) = Qnil;
-            }
+		QString *s = (QString*)m->item().s_voidp;
+		if (s != 0) {
+			if (s->isNull()) {
+				*(m->var()) = Qnil;
+			} else {
+				*(m->var()) = rstringFromQString(s);
+			}
+			if (m->cleanup() || m->type().isStack()) {
+				delete s;
+			}
+		} else {
+			*(m->var()) = Qnil;
+		}
 	}
 	break;
-      default:
-	m->unsupported();
-	break;
+	default:
+		m->unsupported();
+		break;
     }
 }
 



More information about the Kde-bindings mailing list