diff --git a/Qt_EQL/tutorial/main.cpp b/Qt_EQL/tutorial/main.cpp index c41b356..62ddd92 100644 --- a/Qt_EQL/tutorial/main.cpp +++ b/Qt_EQL/tutorial/main.cpp @@ -23,9 +23,9 @@ int main(int argc, char* argv[]) { EQL::addObject(new Test(main), "*test*", true); // 'define-qt-wrappers' - EQL::eval("(load \"test.lisp\")"); // will start a REPL - app.processEvents(); // needed for 'qlater' in 'test.lisp' + EQL::eval("(load \"test.lisp\")"); // will start a REPL + app.processEvents(); // needed for 'qlater' in 'test.lisp' - return 0; // no 'app.exec()' because of REPL + return 0; // no 'app.exec()' because of REPL } diff --git a/Qt_EQL/tutorial/test.h b/Qt_EQL/tutorial/test.h index fdac7a3..773a17a 100644 --- a/Qt_EQL/tutorial/test.h +++ b/Qt_EQL/tutorial/test.h @@ -19,7 +19,7 @@ public Q_SLOTS: // pointers, of course), as you'll find in any Qt example code QString concat(const QStringList&); - // pass Lisp data ('cl_object' is just a word hosting e.g. a pointer) + // pass Lisp data ('cl_object' is just a pointer) void processData(cl_object); // call back to Lisp diff --git a/src/ecl_fun.cpp b/src/ecl_fun.cpp index faa109e..41b7e37 100644 --- a/src/ecl_fun.cpp +++ b/src/ecl_fun.cpp @@ -126,8 +126,6 @@ void iniCLFunctions() { cl_make_package(1, eql); } si_select_package(eql); DEFUN ("%error-msg", error_msg2, 2) - DEFUN ("%finalize", finalize2, 1) - DEFUN ("%finalize-and-delete", finalize_and_delete2, 1) DEFUN ("%make-qimage/dangerous", make_qimage_dangerous, 5) DEFUN ("no-qexec", no_qexec, 0) DEFUN ("qadd-event-filter", qadd_event_filter, 3) @@ -697,9 +695,6 @@ QtObject toQtObject(cl_object l_obj, cl_object l_cast, bool* qobject_align, bool static cl_object new_qt_object(void* pointer, uint unique, int id, bool finalize = false) { STATIC_SYMBOL_PKG (s_new_qt_object, "NEW-QT-OBJECT", "EQL") - QPointer* safePointer = 0; - if((id > 0) && pointer) { // QObject - safePointer = new QPointer((QObject*)pointer); } cl_object l_qt_object = cl_funcall(5, s_new_qt_object, ecl_make_unsigned_integer((quintptr)pointer), diff --git a/src/ecl_fun.h b/src/ecl_fun.h index 9f16c0e..18fa2c6 100644 --- a/src/ecl_fun.h +++ b/src/ecl_fun.h @@ -242,8 +242,6 @@ class QObject; class QEvent; cl_object error_msg2 (cl_object, cl_object); -cl_object finalize2 (cl_object); -cl_object finalize_and_delete2 (cl_object); cl_object make_qimage_dangerous (cl_object, cl_object, cl_object, cl_object, cl_object); cl_object no_qexec (); cl_object qadd_event_filter (cl_object, cl_object, cl_object); @@ -301,11 +299,10 @@ cl_object set_shutdown_p (cl_object); struct EQL_EXPORT QtObject { void* pointer; - QPointer* safe_pointer; uint unique; int id; - QtObject() : pointer(nullptr), safe_pointer(nullptr), unique(0), id(0) {} + QtObject() : pointer(0), unique(0), id(0) {} bool isQObject() const { return (id > 0); } bool isStatic() const { return !pointer; } diff --git a/src/lisp/ini.lisp b/src/lisp/ini.lisp index 81bc8f8..ddc4d55 100644 --- a/src/lisp/ini.lisp +++ b/src/lisp/ini.lisp @@ -391,7 +391,8 @@ (defun new-qt-object (pointer unique id finalize) (let ((obj (qt-object pointer unique id finalize))) - (ext:set-finalizer obj (if finalize '%finalize-and-delete '%finalize)) + (when finalize + (ext:set-finalizer obj 'qdelete)) obj)) (defmethod print-object ((object qt-object) s) diff --git a/src/lisp/qml.lisp b/src/lisp/qml.lisp index 5703894..05d47bd 100644 --- a/src/lisp/qml.lisp +++ b/src/lisp/qml.lisp @@ -78,7 +78,7 @@ (|rootContext| *quick-view*))) (defun find-quick-item (object-name) - "Finds the first QQuickItem matching OBJECT-NAME. You may set *ROOT-ITEM* if you want to find items inside a specific item, like in a QML Repeater. See also note in sources." + "Finds the first QQuickItem matching OBJECT-NAME. Locally set *ROOT-ITEM* if you want to find items inside a specific item, like in a QML Repeater. See also note in sources." ;; ;; when to use *ROOT-ITEM* ;; @@ -97,8 +97,8 @@ ;; (q< |text| ui:*edit*) ;; (setf qml:*root-item* nil) ; (2) reset ;; - ;; N.B. we need SETF here because of the global variable and threads (because - ;; QRUN* is used internally here) + ;; N.B. we need SETF (instead of LET) because of the global var and threads + ;; (QRUN* is used internally here) ;; (let ((parent (or *root-item* (root-item)))) (unless (qnull parent)