Fix QT:APPLICATION cleanup in QT:WITH-APP and add restart to slot invocation.
Thu Jun 4 00:02:12 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Fix QT:APPLICATION cleanup in QT:WITH-APP and add restart to slot invocation.
hunk ./src/application.lisp 47
- ;(assert (null-pointer-p (smoke::pointer (core-application.instance))))
+ (assert (null-pointer-p (smoke::pointer (core-application.instance)))
+ ()
+ "Active QCoreApplication not created by QT:WITH-APP.")
hunk ./src/application.lisp 55
- (values (make-instance 'qt:application :args (list argc argv)) t))))
+ (let ((app (make-instance 'qt:application :args (list argc argv))))
+ (tg:cancel-finalization app)
+ (values app t)))))
hunk ./src/application.lisp 59
+ (when (typep (app) 'application)
+ (application.close-all-windows)
+ ;; widgets are only valid as long, as an application object exists.
+ ;; QApplication::~QApplication() deletes all widgets in
+ ;; QApplication::allWidgets().
+ ;; [_$_]
+ ;; see: qt4/src/gui/kernel/qapplication.cpp
+ (loop for widget across (application.all-widgets) do
+ (trivial-garbage:cancel-finalization widget)))
hunk ./src/application.lisp 69
- (when (typep (app) (find-class 'qt:application))
- (application.close-all-windows))
hunk ./src/application.lisp 70
- (trivial-garbage:cancel-finalization (app))
- (smoke::remove-object (smoke::pointer (app)))
- ;; FIXME leak memory or memory fault!
- ;(smoke::delete-pointer (smoke::pointer (app)) (class-of (app)))
- (cxx:delete-later (app))
+ ;; Call the destructer; -> destructed callback is called,
+ ;; (~QApplication() is virtual) which takes care of cleanup
+ ;; on the Lisp side.
+ (smoke::delete-pointer (smoke::pointer (app)) (class-of (app)))
hunk ./src/application.lisp 108
- (application.close-all-windows)
hunk ./src/application.lisp 116
- (find-restart 'continue))))
+ (and (app-p)
+ (find-restart 'continue)))))
hunk ./src/operator.lisp 77
- ;;FIXME smoke does not support casting operators => can not
- ;; return a useful value with operator[]."
- ;;(cxx:operator[] object index))
hunk ./src/operator.lisp 91
+ ;; FIXME smoke generates no destructor for QByteRef
+ ;; kaylptusCxxToSmoke.pm 954:
+ ;; # Also, if the class has no explicit destructor, generate a default one.
+ ;; if ( !$hasDestructor && !$hasPrivatePureVirtual && !$isGlobalSpace && $classNode->{NodeType} ne 'namespace' ) {
+ ;; > $hasPublicDestructor = 1;
+ ;; > $hasPublicProtectedConstructor = 1;
+ ;; [_$_]
hunk ./src/signal-slot/slot.lisp 38
- (case id
+ (ccase id
hunk ./src/signal-slot/slot.lisp 40
- (apply (slot-function slot)
- (arguments-to-lisp arguments (arguments slot))))))
+ (with-simple-restart
+ (continue "Skip the function ~A of slot ~A."
+ (slot-function slot) slot)
+ (apply (slot-function slot)
+ (arguments-to-lisp arguments (arguments slot)))))))