void CSdlAppServ::Init() { PANIC_IF_ERROR(iAppThread.Open(iMainId)); }
TInt DoMain(TAny* /*aParam*/) { TBool fbsconnected = EFalse; CTrapCleanup* cleanup = NULL; if(EnvUtils::IsOwnThreaded()) { cleanup = CTrapCleanup::New(); if(RFbsSession::GetSession() == NULL) { PANIC_IF_ERROR(RFbsSession::Connect()); fbsconnected = ETrue; } } gEpocEnv->iAppSrv->Init(); #ifdef SYMBIANC // Create stdlib _REENT; #endif // Call stdlib main int ret = 0; if(EnvUtils::IsOwnThreaded()) { //completes waiting rendesvous RThread::Rendezvous(KErrNone); } TRAPD(err, err = MainL()); EpocSdlEnv::ObserverEvent(MSDLObserver::EEventMainExit, err); // Free resources and return /* if(gLastError.Length() > 0) { TBuf<74> text; text.Append(_L("SDL:")); text.Append(gLastError); User::Panic(text, err); } User::Panic(_L("GRR..."), err); */ EpocSdlEnv::FreeSurface(); EpocSdlEnv::CleanupItems(); gEpocEnv->iCleanupItems->Reset(); delete gEpocEnv->iCleanupItems; gEpocEnv->iCleanupItems = NULL; delete gEpocEnv->iChildThreads; gEpocEnv->iCleanupItems = NULL; gEpocEnv->Free(); //free up in thread resources #ifdef SYMBIANC _cleanup(); //this is normally called at exit, I call it here #endif if(fbsconnected) RFbsSession::Disconnect(); #ifdef SYMBIANC CloseSTDLIB(); #endif // delete as; delete cleanup; if(gEpocEnv->iCallerStatus != NULL) { User::RequestComplete(gEpocEnv->iCallerStatus, err); return 0; } else { return err == KErrNone ? ret : err; } }