aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2022-05-15 14:14:39 +0000
committerSaturneric <[email protected]>2022-05-15 14:14:39 +0000
commit1bfab7bb05144dfe7113d62b23e72620099d65fb (patch)
treeba3cbb32a9d7aa2850fbdb9ce2198a463fadc507
parentfix: solve debug/release ci problems on macOS ci (diff)
downloadGpgFrontend-1bfab7bb05144dfe7113d62b23e72620099d65fb.tar.gz
GpgFrontend-1bfab7bb05144dfe7113d62b23e72620099d65fb.zip
fix: solve dll export problem on inner class
-rw-r--r--src/core/thread/Task.h30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/core/thread/Task.h b/src/core/thread/Task.h
index e2105415..468a04b8 100644
--- a/src/core/thread/Task.h
+++ b/src/core/thread/Task.h
@@ -19,8 +19,10 @@
* The initial version of the source code is inherited from
* the gpg4usb project, which is under GPL-3.0-or-later.
*
- * The source code version of this software was modified and released
- * by Saturneric<[email protected]><[email protected]> starting on May 12, 2021.
+ * All the source code of GpgFrontend was modified and released by
+ * Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
*
*/
@@ -54,7 +56,7 @@ class GPGFRONTEND_CORE_EXPORT Task : public QObject, public QRunnable {
* @brief DataObject to be passed to the callback function.
*
*/
- class DataObject {
+ class GPGFRONTEND_CORE_EXPORT DataObject {
public:
struct Destructor {
const void *p_obj;
@@ -94,6 +96,28 @@ class GPGFRONTEND_CORE_EXPORT Task : public QObject, public QRunnable {
* @brief
*
* @tparam T
+ * @param ptr
+ */
+ template <typename T>
+ void AppendObject(T *obj) {
+ LOG(INFO) << "called:" << this;
+ auto *obj_dstr = this->get_heap_ptr(sizeof(T));
+ auto *ptr_heap = new ((void *)obj_dstr->p_obj) T(std::move(*obj));
+ if (std::is_class_v<T>) {
+ auto destructor = [](const void *x) {
+ static_cast<const T *>(x)->~T();
+ };
+ obj_dstr->destroy = destructor;
+ } else {
+ obj_dstr->destroy = nullptr;
+ }
+ data_objects_.push(std::move(obj_dstr));
+ }
+
+ /**
+ * @brief
+ *
+ * @tparam T
* @return std::shared_ptr<T>
*/
template <typename T>