Recommended backport by upstream kde/plasma to fix plasmashell crashes.

https://bugs.kde.org/show_bug.cgi?id=513527
https://mail.kde.org/pipermail/distributions/2026-January/001667.html
https://qt-project.atlassian.net/browse/QTBUG-142514
https://codereview.qt-project.org/c/qt/qtdeclarative/+/704031
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1580,8 +1580,7 @@
             } else {
                 // If the object is C++-owned, we still have to release the weak reference we have
-                // to it.
-                ddata->jsWrapper.clear();
-                if (lastCall && ddata->propertyCache)
-                    ddata->propertyCache.reset();
+                // to it. If the "main" wrapper is not ours, we should leave it alone, though.
+                if (ddata->jsWrapper.as<QObjectWrapper>() == this)
+                    ddata->jsWrapper.clear();
             }
         }
