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

Function gjs_object_custom_init

gi/gobject.cpp:267–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267static void gjs_object_custom_init(GTypeInstance* instance,
268 void* g_class [[maybe_unused]]) {
269 JSContext* cx = current_js_context();
270 GjsContextPrivate* gjs = GjsContextPrivate::from_cx(cx);
271
272 if (gjs->object_init_list().empty())
273 return;
274
275 JS::RootedObject object(cx, gjs->object_init_list().back());
276 auto* priv_base = ObjectBase::for_js_nocheck(object);
277 g_assert(priv_base); // Should have been set in init_impl()
278 ObjectInstance* priv = priv_base->to_instance();
279
280 if (priv_base->gtype() != G_TYPE_FROM_INSTANCE(instance)) {
281 // This is not the most derived instance_init function, do nothing.
282 return;
283 }
284
285 gjs->object_init_list().popBack();
286
287 if (!priv->init_custom_class_from_gobject(cx, object, G_OBJECT(instance)))
288 gjs_log_exception_uncaught(cx);
289}
290
291static void gjs_interface_init(void* g_iface, void*) {
292 GType gtype = G_TYPE_FROM_INTERFACE(g_iface);

Callers

nothing calls this directly

Calls 6

current_js_contextFunction · 0.85
emptyMethod · 0.80
to_instanceMethod · 0.80
gtypeMethod · 0.45

Tested by

no test coverage detected