Support ownership transfer to non smoke wrapped QObjects & cleanup C++ to Lisp translation.
src/signal-slot/translate.lisp
Sun Aug 2 13:15:21 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Support ownership transfer to non smoke wrapped QObjects & cleanup C++ to Lisp translation.
--- old-qt.gui/src/signal-slot/translate.lisp 2014-10-30 07:44:47.000000000 +0100
+++ new-qt.gui/src/signal-slot/translate.lisp 2014-10-30 07:44:47.000000000 +0100
@@ -52,12 +52,11 @@
;; returns.
(disown-object (smoke::object-to-lisp pointer type)))
(ecase (smoke::type-id type)
- (0 (let ((cffi-type (smoke::get-type (name type))))
- (if (null cffi-type)
- (progn
- pointer)
- (convert-from-foreign pointer
- cffi-type))))
+ (0 (if-let ((translation (gethash (name type) smoke::*to-lisp-translations*)))
+ ;; Do not free stack allocated stuff (e.g.: QString); that is the callers
+ ;; responisbility.
+ (funcall (car translation) pointer)
+ (error "Do not know how to convert the type ~A to Lisp." type)))
(1 (mem-ref pointer 'cxx-bool))
(2 (code-char (mem-ref pointer :char)))
(3 (code-char (mem-ref pointer :unsigned-char)))