[Kde-bindings] kdebindings/qtruby

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sun Oct 3 11:32:41 UTC 2004


CVS commit by rdale: 

* A common programming error is to accidently leave off the 'new' method call when 
creating an instance. The QtRuby runtime wasn't correctly trapping an attempt to 
call an instance method on a class object, and was seg faulting rather than 
throwing an exception. 

* For example: 

            # The next line should be:  lay = Qt::HBoxLayout.new(self) 
           lay = Qt::HBoxLayout 
           ed = Qt::LineEdit.new('blah',self) 
           lay.addWidget(ed) 

* Fixes problem reported by Han Holl 

CCMAIL: kde-bindings at kde.org


  M +18 -0     ChangeLog   1.114
  M +7 -0      rubylib/qtruby/Qt.cpp   1.92


--- kdebindings/qtruby/rubylib/qtruby/Qt.cpp  #1.91:1.92
@@ -275,4 +275,5 @@ public:
         if(_called) return;
         _called = true;
+        
         VALUE _retval = rb_funcall2(_obj,
                                     rb_intern(_smoke->methodNames[method().name]),
@@ -413,4 +414,9 @@ public:
         if(_called) return;
         _called = true;
+        
+        if (_target == Qnil && !(method().flags & Smoke::mf_static)) {
+                rb_raise(rb_eArgError, "%s is not a class method\n", _smoke->methodNames[method().name]);
+        }
+        
         Smoke::ClassFn fn = _smoke->classes[method().classId].classFn;
         void *ptr = _smoke->cast(_current_object, _current_object_class, method().classId);
@@ -795,4 +801,5 @@ void logger_backend(const char *format, 
     // TODO - allow qtruby programs to override this fprintf with their own logging
     fprintf(stdout, "%s\n", StringValuePtr(val_str));
+        fflush(stdout);
     va_end(ap);
 }

--- kdebindings/qtruby/ChangeLog  #1.113:1.114
@@ -1,4 +1,22 @@
 2004-10-03  Richard Dale  <Richard_Dale at tipitina.demon.co.uk>
 
+ * A common programming error is to accidently leave off the 'new' method call when
+   creating an instance. The QtRuby runtime wasn't correctly trapping an attempt to
+   call an instance method on a class object, and was seg faulting rather than
+   throwing an exception.
+
+ * For example:
+
+                    # The next line should be:  lay = Qt::HBoxLayout.new(self)
+                   lay = Qt::HBoxLayout
+                   ed = Qt::LineEdit.new('blah',self)
+                   lay.addWidget(ed)
+
+ * Fixes problem reported by Han Holl
+
+ CCMAIL: kde-bindings at kde.org
+
+2004-10-03  Richard Dale  <Richard_Dale at tipitina.demon.co.uk>
+
  * Upped version to 1.0.3 for the KDE 3.3.1 release
 





More information about the Kde-bindings mailing list