static void gf_sm_svg_flush_state(GF_SVG_Parser *parser)
{
	while (gf_list_count(parser->node_stack)) {
		SVG_NodeStack *st = (SVG_NodeStack *)gf_list_last(parser->node_stack);
		gf_list_rem_last(parser->node_stack);
		gf_free(st);
	}
	/*FIXME - if there still are som deferred listeners, we should pass them to the scene graph
	and wait for the parent to be defined*/
	while (gf_list_count(parser->deferred_listeners)) {
		GF_Node *l = (GF_Node *)gf_list_last(parser->deferred_listeners);
		gf_list_rem_last(parser->deferred_listeners);
		/*listeners not resolved are not inserted in the tree - destroy them*/
		gf_node_register(l, NULL);
		gf_node_unregister(l, NULL);
	}
}
static void gf_sm_svg_flush_state(GF_SVG_Parser *parser)
{
	while (gf_list_count(parser->node_stack)) {
		SVG_NodeStack *st = (SVG_NodeStack *)gf_list_last(parser->node_stack);
		gf_list_rem_last(parser->node_stack);
		gf_free(st);
	}
	 
	while (gf_list_count(parser->deferred_listeners)) {
		GF_Node *l = (GF_Node *)gf_list_last(parser->deferred_listeners);
		gf_list_rem_last(parser->deferred_listeners);
		 
		gf_node_register(l, NULL);
		gf_node_unregister(l, NULL);
	}
}