Fix ownership transfer for lambda slot to no Smoke object.
Mon Jul 27 21:39:43 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Fix ownership transfer for lambda slot to no Smoke object.
hunk ./src/signal-slot/connect.lisp 127
- ;; Set the sender as the slots parent,
- ;; to ensure it does not get gc'ed.
- ;;
- ;; FIXME: unset parent on disconnect.
- ;; This no not critical because the slot
- ;; object is not accessible to the user,
- ;; who thus can not connect it to other
- ;; signals.
- :args (list (qsender qt-signal))
hunk ./src/signal-slot/connect.lisp 132
+ ;; Ensure that the slot is not gc'ed as long as the QT-SIGNAL
+ ;; exists.
+ ;;
+ ;; FIXME: remove on disconnect.
+ ;; This no not critical because the slot
+ ;; object is not accessible to the user,
+ ;; who thus can not connect it to other
+ ;; signals.
+ (if (smoke::has-pointer-p (smoke:pointer (qsender qt-signal)))
+ (setf (cxx:parent slot) (qsender qt-signal))
+ ;; when QT-SIGNAL is not a Smoke instance.
+ (progn
+ (unless (qt:property-p (qsender qt-signal) 'connected-slots)
+ (setf (qt:property (qsender qt-signal) 'connected-slots)
+ (qt:make-lisp-variant (list))))
+ (setf (qt:property (qsender qt-signal) 'connected-slots)
+ (qt:make-lisp-variant
+ (cons slot
+ (qt:property (qsender qt-signal) 'connected-slots))))))