MCPcopy Create free account
hub / github.com/GNOME/gjs / associate_closure

Method associate_closure

gi/object.cpp:2911–2924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2909}
2910
2911void ObjectInstance::associate_closure(JSContext* cx, GClosure* closure) {
2912 if (!is_prototype())
2913 to_instance()->ensure_uses_toggle_ref(cx);
2914
2915 g_assert(std::find(m_closures.begin(), m_closures.end(), closure) ==
2916 m_closures.end() &&
2917 "This closure was already associated with this object");
2918
2919 /* This is a weak reference, and will be cleared when the closure is
2920 * invalidated */
2921 m_closures.push_back(closure);
2922 g_closure_add_invalidate_notifier(
2923 closure, this, &ObjectInstance::closure_invalidated_notify);
2924}
2925
2926void ObjectInstance::closure_invalidated_notify(void* data, GClosure* closure) {
2927 // This callback should *only* touch m_closures

Callers 3

inMethod · 0.80
gjs_associate_closureFunction · 0.80
connect_implMethod · 0.80

Calls 3

beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected