- /* our running main service stopped. */
- if (!m_playlist.empty())
- m_playlist.erase(m_playlist.begin());
- if (!m_playlist.empty())
+ assert(m_playlist); /* we need to have a playlist */
+
+ /* at first, kill the running service */
+ m_event(this, evStopService);
+ m_runningService = 0;
+ m_service_event_conn = 0;
+ /* our running main service stopped. identify what to do next. */
+
+ /* unless the playlist current position is invalid (because there was */
+ /* playlist, for example when the service was engaged with playService */
+ if (m_playlist->m_current != m_playlist->end())
+ ++m_playlist->m_current;
+
+ /* was the current service the last one? */
+ if (m_playlist->m_current == m_playlist->end())