bugfix for cancelling
[enigma2.git] / lib / nav / core.cpp
index 5dc45999cfbb00e0e5a1fe92b774d376cc593169..062a7d00046a48d7736eb0fd9dae146bf55fcc73 100644 (file)
@@ -4,9 +4,9 @@
 
 void eNavigation::serviceEvent(iPlayableService* service, int event)
 {
-       if (service != m_runningService)
+       if (m_runningService && service != m_runningService)
        {
-               eDebug("nav: event for other service");
+               eDebug("nav: event %d for other service", event);
                return;
        }
        m_event(event);
@@ -59,12 +59,15 @@ RESULT eNavigation::stopService(void)
                /* check if there is a running service... */
        if (!m_runningService)
                return 1;
-                       /* send stop event */
+
+       ePtr<iPlayableService> tmp = m_runningService;
+       m_runningService=0;
+       tmp->stop();
+
+       /* send stop event */
        m_event(iPlayableService::evEnd);
 
-       m_runningService->stop();
                /* kill service. */
-       m_runningService = 0;
        m_service_event_conn = 0;
        return 0;
 }
@@ -93,8 +96,11 @@ RESULT eNavigation::stopRecordService(ePtr<iRecordableService> &service)
        if (it != m_recordings.end())
        {
                m_recordings.erase(it);
+               /* send stop event */
+               m_record_event(service, iRecordableService::evEnd);
                return 0;
        }
+
        eDebug("try to stop non running recording!!");  // this should not happen
        return -1;
 }