MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / registerScriptObject

Method registerScriptObject

src/script/engine.h:94–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92 }
93
94 ScriptObject* registerScriptObject(inject<ScriptObject>&& sobj) {
95 ScriptObject* ret = &*sobj;
96 auto raw = sobj->m_handle.get<void>();
97 sobj->getInternalScriptObject()->onRelease = [=, this]{
98 auto it = m_ObjToScriptObj.find(raw);
99 if (it == m_ObjToScriptObj.end())
100 return;
101 it->second->held = false;
102 };
103 auto hold = std::make_shared<HeldObject>(std::move(sobj), sobj->m_handle);
104 m_ObjToScriptObj.emplace(std::make_pair(raw, hold));
105 m_scriptObjects.push_back(hold);
106 return ret;
107 }
108
109 private:
110 Provides m_provides{this};

Callers

nothing calls this directly

Calls 2

endMethod · 0.45

Tested by

no test coverage detected