diff --git a/src/proxy/plugin_python_en.ts b/src/proxy/plugin_python_en.ts
index 99302dd..4a3814e 100644
--- a/src/proxy/plugin_python_en.ts
+++ b/src/proxy/plugin_python_en.ts
@@ -14,48 +14,48 @@
-
+ ModOrganizer path contains a semicolon
-
+ Python DLL not found
-
+ Invalid Python DLL
-
+ Initializing Python failed
-
-
+
+ invalid problem key %1
-
+ The path to Mod Organizer (%1) contains a semicolon. <br>While this is legal on NTFS drives, many softwares do not handle it correctly.<br>Unfortunately MO depends on libraries that seem to fall into that group.<br>As a result the python plugin cannot be loaded, and the only solution we canoffer is to remove the semicolon or move MO to a path without a semicolon.
-
+ The Python plugin DLL was not found, maybe your antivirus deleted it. Re-installing MO2 might fix the problem.
-
+ The Python plugin DLL is invalid, maybe your antivirus is blocking it. Re-installing MO2 and adding exclusions for it to your AV might fix the problem.
-
+ The initialization of the Python plugin DLL failed, unfortunately without any details.
diff --git a/src/proxy/proxypython.cpp b/src/proxy/proxypython.cpp
index 035063c..0e43c36 100644
--- a/src/proxy/proxypython.cpp
+++ b/src/proxy/proxypython.cpp
@@ -169,7 +169,12 @@ QList ProxyPython::load(const QString& identifier)
if (!m_Runner) {
return {};
}
- return m_Runner->load(identifier);
+
+ auto plugins = m_Runner->load(identifier);
+ for (auto* plugin : plugins) {
+ plugin->setParent(this);
+ }
+ return plugins;
}
void ProxyPython::unload(const QString& identifier)
diff --git a/src/runner-pybind11/pybind11_all.h b/src/runner-pybind11/pybind11_all.h
new file mode 100644
index 0000000..93e8e08
--- /dev/null
+++ b/src/runner-pybind11/pybind11_all.h
@@ -0,0 +1,15 @@
+#ifndef PYTHON_PYBIND11_ALL_H
+#define PYTHON_PYBIND11_ALL_H
+
+#include
+#include
+#include
+#include
+
+#include "pybind11_utils/functional.h"
+
+#include "pybind11_qt/pybind11_qt.h"
+
+#include "pybind11_utils/shared_cpp_owner.h"
+
+#endif
diff --git a/src/runner-pybind11/pybind11_qt/details/pybind11_qt_sip.h b/src/runner-pybind11/pybind11_qt/details/pybind11_qt_sip.h
index a01f4bf..d1a29c0 100644
--- a/src/runner-pybind11/pybind11_qt/details/pybind11_qt_sip.h
+++ b/src/runner-pybind11/pybind11_qt/details/pybind11_qt_sip.h
@@ -9,6 +9,8 @@
#include
#include
+#include "../pybind11_qt_holder.h"
+
namespace pybind11::detail::qt {
/**
@@ -96,6 +98,12 @@ namespace pybind11::detail::qt {
if (data) {
if constexpr (is_pointer) {
value = reinterpret_cast(data);
+
+ // transfer ownership
+ sipAPI()->api_transfer_to(src.ptr(), Py_None);
+
+ // tie the py::object to the C++ one
+ new pybind11::detail::qt::qobject_holder(value);
}
else {
value = *reinterpret_cast(data);
diff --git a/src/runner-pybind11/pybind11_qt/pybind11_qt.h b/src/runner-pybind11/pybind11_qt/pybind11_qt.h
index eafaffb..4a33b07 100644
--- a/src/runner-pybind11/pybind11_qt/pybind11_qt.h
+++ b/src/runner-pybind11/pybind11_qt/pybind11_qt.h
@@ -4,6 +4,7 @@
#include "pybind11_qt_basic.h"
#include "pybind11_qt_containers.h"
#include "pybind11_qt_enums.h"
+#include "pybind11_qt_holder.h"
#include "pybind11_qt_objects.h"
#include "pybind11_qt_qflags.h"
diff --git a/src/runner-pybind11/pybind11_qt/pybind11_qt_holder.h b/src/runner-pybind11/pybind11_qt/pybind11_qt_holder.h
new file mode 100644
index 0000000..6438c8c
--- /dev/null
+++ b/src/runner-pybind11/pybind11_qt/pybind11_qt_holder.h
@@ -0,0 +1,47 @@
+#ifndef PYTHON_PYBIND11_QT_HOLDER_HPP
+#define PYTHON_PYBIND11_QT_HOLDER_HPP
+
+#include
+
+#include
+
+namespace pybind11::detail::qt {
+
+ class qobject_holder : public QObject {
+ object p_;
+
+ public:
+ template
+ qobject_holder(U* p) : p_{reinterpret_borrow