gui/audio: Disable the audio timeout function during shutdown
Otherwise we may try to use the gstreamer playbin after destroying it, leading to various error messages showing up in the console. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
a4049f8d01
commit
a36fd137d5
10
gui/audio.c
10
gui/audio.c
|
@ -11,6 +11,8 @@
|
||||||
#include <gui/view.h>
|
#include <gui/view.h>
|
||||||
#include <gui/window.h>
|
#include <gui/window.h>
|
||||||
|
|
||||||
|
static guint audio_timeout = 0;
|
||||||
|
|
||||||
static inline void __audio_set_label(const gchar *label, const gchar *size,
|
static inline void __audio_set_label(const gchar *label, const gchar *size,
|
||||||
const gchar *text)
|
const gchar *text)
|
||||||
{
|
{
|
||||||
|
@ -123,11 +125,17 @@ struct audio_ops audio_ops = {
|
||||||
void gui_audio_init()
|
void gui_audio_init()
|
||||||
{
|
{
|
||||||
GtkScaleButton *volume = GTK_SCALE_BUTTON(gui_builder_widget("o_volume"));
|
GtkScaleButton *volume = GTK_SCALE_BUTTON(gui_builder_widget("o_volume"));
|
||||||
g_timeout_add(500, __audio_timeout, gui_builder_object("o_progress"));
|
audio_timeout = g_timeout_add(500, __audio_timeout,
|
||||||
|
gui_builder_object("o_progress"));
|
||||||
gtk_scale_button_set_value(volume, audio_get_volume());
|
gtk_scale_button_set_value(volume, audio_get_volume());
|
||||||
gtk_button_set_relief(GTK_BUTTON(volume), GTK_RELIEF_NORMAL);
|
gtk_button_set_relief(GTK_BUTTON(volume), GTK_RELIEF_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gui_audio_deinit()
|
||||||
|
{
|
||||||
|
g_source_remove(audio_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_TESTING
|
#ifdef CONFIG_TESTING
|
||||||
void test_gui_audio_timeout()
|
void test_gui_audio_timeout()
|
||||||
{
|
{
|
||||||
|
|
|
@ -123,6 +123,7 @@ static void __ocarina_startup(GApplication *application, gpointer data)
|
||||||
static void __ocarina_shutdown(GApplication *application, gpointer data)
|
static void __ocarina_shutdown(GApplication *application, gpointer data)
|
||||||
{
|
{
|
||||||
gui_idle_disable();
|
gui_idle_disable();
|
||||||
|
gui_audio_deinit();
|
||||||
core_deinit();
|
core_deinit();
|
||||||
|
|
||||||
gui_treeview_deinit();
|
gui_treeview_deinit();
|
||||||
|
|
|
@ -10,6 +10,9 @@ extern struct audio_ops audio_ops;
|
||||||
/* Called to initialize the GUI audio controls. */
|
/* Called to initialize the GUI audio controls. */
|
||||||
void gui_audio_init();
|
void gui_audio_init();
|
||||||
|
|
||||||
|
/* Called to stop the GUI audio timeout function. */
|
||||||
|
void gui_audio_deinit();
|
||||||
|
|
||||||
#ifdef CONFIG_TESTING
|
#ifdef CONFIG_TESTING
|
||||||
void test_gui_audio_timeout();
|
void test_gui_audio_timeout();
|
||||||
#endif /* CONFIG_TESTING */
|
#endif /* CONFIG_TESTING */
|
||||||
|
|
|
@ -136,6 +136,7 @@ int main(int argc, char **argv)
|
||||||
gui_builder_init("share/ocarina/ocarina.ui");
|
gui_builder_init("share/ocarina/ocarina.ui");
|
||||||
gui_model_init();
|
gui_model_init();
|
||||||
core_init(&argc, NULL, &init_data);
|
core_init(&argc, NULL, &init_data);
|
||||||
|
gui_audio_init();
|
||||||
playlist_new(PL_LIBRARY, "tests/Music/Hyrule Symphony");
|
playlist_new(PL_LIBRARY, "tests/Music/Hyrule Symphony");
|
||||||
while (idle_run_task()) {};
|
while (idle_run_task()) {};
|
||||||
|
|
||||||
|
@ -143,6 +144,7 @@ int main(int argc, char **argv)
|
||||||
g_test_add_func("/Gui/Audio", test_audio);
|
g_test_add_func("/Gui/Audio", test_audio);
|
||||||
ret = g_test_run();
|
ret = g_test_run();
|
||||||
|
|
||||||
|
gui_audio_deinit();
|
||||||
gui_window_deinit();
|
gui_window_deinit();
|
||||||
gui_model_deinit();
|
gui_model_deinit();
|
||||||
gui_builder_deinit();
|
gui_builder_deinit();
|
||||||
|
|
Loading…
Reference in New Issue