GF_SceneGraph *gf_sg_new()
{
	GF_SceneGraph *tmp;
	GF_SAFEALLOC(tmp, GF_SceneGraph);
	if (!tmp) return NULL;

	tmp->exported_nodes = gf_list_new();

#ifndef GPAC_DISABLE_VRML
	tmp->protos = gf_list_new();
	tmp->unregistered_protos = gf_list_new();
	tmp->Routes = gf_list_new();
	tmp->routes_to_activate = gf_list_new();
	tmp->routes_to_destroy = gf_list_new();
#endif

#ifndef GPAC_DISABLE_SVG
	tmp->dom_evt_mx = gf_mx_new("DOMEvent");
	tmp->dom_evt = gf_dom_event_target_new(GF_DOM_EVENT_TARGET_DOCUMENT, tmp);
	tmp->xlink_hrefs = gf_list_new();
	tmp->smil_timed_elements = gf_list_new();
	tmp->modified_smil_timed_elements = gf_list_new();
	tmp->listeners_to_add = gf_list_new();
#endif

#ifdef GPAC_HAS_QJS
	tmp->scripts = gf_list_new();
	tmp->objects = gf_list_new();
#endif
	tmp->on_node_modified = node_modif_stub;

	//test some functions only used in weird smil anim or dom JS, and not addressed in test suite
#ifdef GPAC_ENABLE_COVERAGE
	if (gf_sys_is_cov_mode()) {
		node_modif_stub(NULL, NULL, NULL, NULL);
		gf_node_remove_id(NULL);
		gf_node_list_get_child(NULL, 0);
		gf_node_get_parent_count(NULL);
		gf_node_get_num_instances(NULL);
		gf_node_get_log_name(NULL);
		gf_sg_get_namespace(NULL, 0);
		gf_node_parent_of(NULL, NULL);
		gf_sg_get_parent(tmp);
		gf_node_get_attribute_count(NULL);
		gf_xml_node_clone(NULL, NULL, NULL, NULL, 0);
		gf_dom_flatten_textContent(NULL);
		gf_smil_timing_pause(NULL);
		gf_smil_timing_resume(NULL);
		gf_smil_get_media_duration(NULL);
	}
#endif
	return tmp;
}
GF_SceneGraph *gf_sg_new()
{
	GF_SceneGraph *tmp;
	GF_SAFEALLOC(tmp, GF_SceneGraph);
	if (!tmp) return NULL;

	tmp->exported_nodes = gf_list_new();

#ifndef GPAC_DISABLE_VRML
	tmp->protos = gf_list_new();
	tmp->unregistered_protos = gf_list_new();
	tmp->Routes = gf_list_new();
	tmp->routes_to_activate = gf_list_new();
	tmp->routes_to_destroy = gf_list_new();
#endif

#ifndef GPAC_DISABLE_SVG
	tmp->dom_evt_mx = gf_mx_new("DOMEvent");
	tmp->dom_evt = gf_dom_event_target_new(GF_DOM_EVENT_TARGET_DOCUMENT, tmp);
	tmp->xlink_hrefs = gf_list_new();
	tmp->smil_timed_elements = gf_list_new();
	tmp->modified_smil_timed_elements = gf_list_new();
	tmp->listeners_to_add = gf_list_new();
#endif

#ifdef GPAC_HAS_QJS
	tmp->scripts = gf_list_new();
	tmp->objects = gf_list_new();
#endif
	tmp->on_node_modified = node_modif_stub;

	 
#ifdef GPAC_ENABLE_COVERAGE
	if (gf_sys_is_cov_mode()) {
		node_modif_stub(NULL, NULL, NULL, NULL);
		gf_node_remove_id(NULL);
		gf_node_list_get_child(NULL, 0);
		gf_node_get_parent_count(NULL);
		gf_node_get_num_instances(NULL);
		gf_node_get_log_name(NULL);
		gf_sg_get_namespace(NULL, 0);
		gf_node_parent_of(NULL, NULL);
		gf_sg_get_parent(tmp);
		gf_node_get_attribute_count(NULL);
		gf_xml_node_clone(NULL, NULL, NULL, NULL, 0);
		gf_dom_flatten_textContent(NULL);
		gf_smil_timing_pause(NULL);
		gf_smil_timing_resume(NULL);
		gf_smil_get_media_duration(NULL);
	}
#endif
	return tmp;
}