fix(editor): make scripting vm ref counted on artboards (#13085) 9aeb2e571b

Co-authored-by: hernan <hernan@rive.app>
diff --git a/.rive_head b/.rive_head
index f9a417d..d60bf74 100644
--- a/.rive_head
+++ b/.rive_head
@@ -1 +1 @@
-2a59ec434e43c9a308c5a99f28ae9008f67ffe52
+9aeb2e571b3f862a846af3b02e0cb651701e1576
diff --git a/include/rive/artboard.hpp b/include/rive/artboard.hpp
index 18bc9b2..25e9f6c 100644
--- a/include/rive/artboard.hpp
+++ b/include/rive/artboard.hpp
@@ -93,7 +93,7 @@
     std::vector<AdvancingComponent*> m_advancingComponents;
     rcp<DataContext> m_DataContext = nullptr;
 #ifdef WITH_RIVE_SCRIPTING
-    ScriptingVM* m_scriptingVM = nullptr;
+    rcp<ScriptingVM> m_scriptingVM = nullptr;
 #endif
     bool m_JoysticksApplyBeforeUpdate = true;
 
@@ -378,7 +378,10 @@
     }
     rcp<DataContext> dataContext() { return m_DataContext; }
 #ifdef WITH_RIVE_SCRIPTING
-    void scriptingVM(ScriptingVM* value) { m_scriptingVM = value; }
+    void scriptingVM(rcp<ScriptingVM> value)
+    {
+        m_scriptingVM = std::move(value);
+    }
 #endif
     // Advances detached scripted view model instances (those with no parents),
     // which are not reachable from the bound view model tree. No-op when
diff --git a/src/file.cpp b/src/file.cpp
index 9966c32..df82440 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -824,7 +824,7 @@
     {
         auto artboardInstance = ab->instance();
 #ifdef WITH_RIVE_SCRIPTING
-        artboardInstance->scriptingVM(m_scriptingVM.get());
+        artboardInstance->scriptingVM(m_scriptingVM);
 #endif
         artboardInstance->file(ref_rcp(this));