Remove studio rooms on studio unload

This commit is contained in:
Nedko Arnaudov 2010-03-21 16:48:04 +02:00
parent 09ae831171
commit 96967baa78
3 changed files with 23 additions and 1 deletions

View File

@ -2,7 +2,7 @@
/*
* LADI Session Handler (ladish)
*
* Copyright (C) 2009 Nedko Arnaudov <nedko@arnaudov.name>
* Copyright (C) 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name>
*
**************************************************************************
* This file contains implementation of the "unload studio" command
@ -39,6 +39,8 @@ static bool run(void * context)
ladish_graph_clear(g_studio.studio_graph, false);
ladish_graph_clear(g_studio.jack_graph, true);
studio_remove_all_rooms();
jack_conf_clear();
g_studio.modified = false;

View File

@ -931,6 +931,25 @@ static void ladish_studio_delete_room(struct dbus_method_call * call_ptr)
return;
}
void studio_remove_all_rooms(void)
{
struct list_head * node_ptr;
ladish_room_handle room;
while (!list_empty(&g_studio.rooms))
{
node_ptr = g_studio.rooms.next;
list_del(node_ptr);
room = ladish_room_from_list_node(node_ptr);
ASSERT(g_studio.room_count > 0);
g_studio.room_count--;
emit_room_disappeared(room);
ladish_room_destroy(room);
}
ASSERT(g_studio.room_count == 0);
}
METHOD_ARGS_BEGIN(GetName, "Get studio name")
METHOD_ARG_DESCRIBE_OUT("studio_name", "s", "Name of studio")
METHOD_ARGS_END

View File

@ -196,5 +196,6 @@ void emit_studio_stopped(void);
void emit_studio_renamed(void);
void on_event_jack_started(void);
void on_event_jack_stopped(void);
void studio_remove_all_rooms(void);
#endif /* #ifndef STUDIO_INTERNAL_H__B4CB73EC_8E89_401A_9E49_F0AEEF361D09__INCLUDED */