From 02da1f586ef7945fef385e6d4743ef53441bc2fa Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Sun, 23 May 2004 20:52:00 +0000 Subject: - eConnections holds reference to object - use eAutoInitPtr instead of eAutoInitP for iObject-based stuff - fix some ref initialization - added service stop --- main/enigma.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'main/enigma.cpp') diff --git a/main/enigma.cpp b/main/enigma.cpp index 4cc8eaf9..668c7c5a 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -27,6 +27,7 @@ class eMain: public eApplication, public Object ePtr m_playservice; ePtr m_nav; ePtr m_conn_event; + ePtr m_serviceInformation; public: eMain() { @@ -38,8 +39,9 @@ public: ePtr service_center; eServiceCenter::getInstance(service_center); + assert(service_center); m_nav = new eNavigation(service_center); -#if 1 +#if 0 if (service_center) { eServiceReference ref("2:0:1:0:0:0:0:0:0:0:/"); @@ -79,6 +81,11 @@ public: { switch (ev) { + case eNavigation::evStopService: + /* very important: the old service should be deallocated, so clear *all* references to it */ + m_serviceInformation = 0; + eDebug("STOP service!"); + break; case eNavigation::evNewService: { ePtr service; @@ -88,14 +95,13 @@ public: eDebug("no running service!"); break; } - ePtr s; - if (service->getIServiceInformation(s)) + if (service->getIServiceInformation(m_serviceInformation)) { eDebug("failed to get iserviceinformation"); break; } eString name; - s->getName(name); + m_serviceInformation->getName(name); eDebug("NEW running service: %s", name.c_str()); break; } @@ -104,6 +110,7 @@ public: break; case eNavigation::evPlaylistDone: eDebug("playlist done"); + quit(); break; default: eDebug("Navigation event %d", ev); @@ -113,7 +120,6 @@ public: ~eMain() { - } }; @@ -127,10 +133,11 @@ void object_dump() #endif int main() -{ +{ #ifdef OBJECT_DEBUG atexit(object_dump); #endif eMain app; - return app.exec(); + int res = app.exec(); + eDebug("after exec"); } -- cgit v1.2.3