changeset 4026:17bf734f8187

avoid crash when audacious is launched with -p option.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Wed, 28 Nov 2007 06:01:28 +0900
parents 66529edae49d
children 501f9671be9b
files src/audacious/auddrct.c src/audacious/main.c src/audacious/ui_main_evlisteners.c
diffstat 3 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/auddrct.c	Tue Nov 27 17:42:52 2007 +0300
+++ b/src/audacious/auddrct.c	Wed Nov 28 06:01:28 2007 +0900
@@ -123,7 +123,7 @@
   if (playback_get_paused())
     playback_pause();
   else if (playlist_get_length(playlist_get_active()))
-    playback_initiate();
+    event_queue("playback initiate", (gpointer)0xdeadbeef); // to avoid crash at startup. --yaz
   else
     mainwin_eject_pushed();
   return;
--- a/src/audacious/main.c	Tue Nov 27 17:42:52 2007 +0300
+++ b/src/audacious/main.c	Wed Nov 28 06:01:28 2007 +0900
@@ -1206,10 +1206,10 @@
             audacious_remote_activate(session);
 
         exit(EXIT_SUCCESS);
-    }
+    } /* is_running */
     else
 #endif
-    {
+    { /* !is_running */
         if (filenames != NULL)
         {
             gint pos = 0;
@@ -1297,7 +1297,7 @@
 
         if (options->activate)
             drct_activate();
-    }
+    } /* !is_running */
 }
 
 static void
--- a/src/audacious/ui_main_evlisteners.c	Tue Nov 27 17:42:52 2007 +0300
+++ b/src/audacious/ui_main_evlisteners.c	Wed Nov 28 06:01:28 2007 +0900
@@ -70,11 +70,18 @@
     equalizerwin_set_balance_slider(b);
 }
 
+static void
+ui_main_evlistener_playback_initiate(gpointer hook_data, gpointer user_data)
+{
+    playback_initiate();
+}
+
 void
 ui_main_evlistener_init(void)
 {
     hook_associate("title change", ui_main_evlistener_title_change, NULL);
     hook_associate("hide seekbar", ui_main_evlistener_hide_seekbar, NULL);
     hook_associate("volume set", ui_main_evlistener_volume_change, NULL);
+    hook_associate("playback initiate", ui_main_evlistener_playback_initiate, NULL);
 }