# HG changeset patch # User Jose Thachil # Date 1273662859 -3600 # Node ID 5b9c23c1a54c8fca2f19e2ac5e80f74b06843da8 # Parent 2bf8a359aa2fbc227a320426c48feb6b1d016975 Removed RDebug statements and added more error checkings. diff -r 2bf8a359aa2f -r 5b9c23c1a54c egl/eglrefimpl/group/eglref.mmp --- a/egl/eglrefimpl/group/eglref.mmp Wed May 12 11:20:41 2010 +0100 +++ b/egl/eglrefimpl/group/eglref.mmp Wed May 12 12:14:19 2010 +0100 @@ -64,21 +64,16 @@ SOURCEPATH ../../sfopenvg/symbian SOURCE riEGLOS.cpp - LIBRARY euser.lib -//added by JT -//LIBRARY sflibopenvgrefimpl.lib library fbscli.lib // For CFbsBitmap, etc library bitgdi.lib // For CFbsBitmapDevice, CFbsBitGc, etc library ws32.lib // For RWindow, Direct Screen Access, etc -library libstdcpp.lib // standard lib +library libstdcpp.lib // standard lib library libc.lib // standard lib library libm.lib // standard lib library edllstub.lib -//End of added by JT - #ifdef WINS LIBRARY ewsd.lib #else diff -r 2bf8a359aa2f -r 5b9c23c1a54c egl/eglrefimpl/inc/eglprivate.h --- a/egl/eglrefimpl/inc/eglprivate.h Wed May 12 11:20:41 2010 +0100 +++ b/egl/eglrefimpl/inc/eglprivate.h Wed May 12 12:14:19 2010 +0100 @@ -180,9 +180,10 @@ // Private APIs EGLint EglSignalSyncInternal(EGLDisplay aDisplay, EGLSyncKHR aSync, EGLenum aMode); - //added by Jose + void SetEgl(EGL* aEgl); EGL* getEgl(); + CEglThreadSession(CEglDriver& aDriver); // Debug APIs #ifdef _DEBUG diff -r 2bf8a359aa2f -r 5b9c23c1a54c egl/eglrefimpl/src/session.cpp --- a/egl/eglrefimpl/src/session.cpp Wed May 12 11:20:41 2010 +0100 +++ b/egl/eglrefimpl/src/session.cpp Wed May 12 12:14:19 2010 +0100 @@ -74,7 +74,7 @@ iDriver(aDriver), iError(EGL_SUCCESS) { - Dll::SetTls( NULL ); //set TLS to NULL Jose + Dll::SetTls( NULL ); } CEglThreadSession::~CEglThreadSession() @@ -87,10 +87,6 @@ { CEglThreadSession* es = reinterpret_cast(Dll::Tls()); - if(es) - { - RDebug::Printf(" &&&&&&&&&&&&&&&&& if CEglThreadSession not null,CEglThreadSession Addr of CEglThreadSession &&&&&&&&&&&= %x\n", es); - } if (es) { return es; @@ -109,10 +105,6 @@ // create session object on default thread's heap es = new CEglThreadSession(*drv); - RDebug::Printf("In CEglThreadSession::Static(),CEglThreadSession Addr of CEglThreadSession Ptr = %x\n", &es); - RDebug::Printf("In CEglThreadSession::Static(),CEglThreadSession Addr of CEglThreadSession= %x\n", es); - //RDebug::Printf("In CEglThreadSession::Static(),Thread Id %Lu",(RThread().Id().Id())); - RDebug::Printf("In CEglThreadSession::Static(),Thread Id %Lu",(RThread().Id())); if (!es || Dll::SetTls(es)!= KErrNone) { delete es; @@ -183,29 +175,39 @@ SetError(EGL_NOT_INITIALIZED); return EGL_FALSE; } + EGL* pEgl = NULL; - pEgl = new EGL(); - iEgl = pEgl; + try + { + pEgl = new EGL(); + iEgl = pEgl; + } + catch(std::bad_alloc) + { + SetError(EGL_BAD_ALLOC); + return EGL_FALSE; + } RIEGLDisplay* Egldisplay = iEgl->getDisplay(aDisplay); //create the current display - //if a context and a surface are bound by the time of eglTerminate, they remain bound until eglMakeCurrent is called + RIEGLDisplay* newDisplay = NULL; try { - newDisplay = new RIEGLDisplay(aDisplay); //throws bad_alloc + newDisplay = new RIEGLDisplay(aDisplay); //throws bad_alloc iEgl->addDisplay(newDisplay); //throws bad_alloc Egldisplay = newDisplay; RI_ASSERT(Egldisplay); } catch(std::bad_alloc) { + RI_DELETE(pEgl); RI_DELETE(newDisplay); - // EGL_RETURN(EGL_BAD_ALLOC, EGL_FALSE); //TODO Need to enable this later. Jose + SetError(EGL_BAD_DISPLAY); + return EGL_FALSE; } - //need to think of deleting egl if anything goes wrong. if (aMajor) { *aMajor = KEglMajorVersion; diff -r 2bf8a359aa2f -r 5b9c23c1a54c egl/sfopenvg/riMiniEGL.cpp --- a/egl/sfopenvg/riMiniEGL.cpp Wed May 12 11:20:41 2010 +0100 +++ b/egl/sfopenvg/riMiniEGL.cpp Wed May 12 12:14:19 2010 +0100 @@ -298,25 +298,9 @@ delete es; return NULL; } - return es->getEgl(); - - //TODO do we need to associate EGL with session here Jose -/* if ((pEgl = static_cast (Dll::Tls())) == NULL) - { - //create TLS instance - pEgl = RI_NEW(EGL, ()); - RDebug::Printf("---------- In getEGL()::Static(),Addr of pEgl Ptr = %x\n", &pEgl); - RDebug::Printf("---------- In getEGL()::Static(),Addr of pEgl= %x\n", pEgl); - //RDebug::Printf("In CEglThreadSession::Static(),Thread Id %Lu",(RThread().Id().Id())); - RDebug::Printf("---------- In getEGL()::Static(),Thread Id %Lu",(RThread().Id())); - Dll::SetTls(pEgl); - }*/ - //return pEgl; - } - static void releaseEGL() { /* @@ -482,19 +466,9 @@ void* eglvgGetCurrentVGContext(void) { EGL* egl = getEGL(); -/* RDebug::Printf(" \n"); - RDebug::Printf(" \n"); - RDebug::Printf(" \n"); - - - RDebug::Printf(" $$$$$$$$$$$$$ I am in function eglvgGetCurrentVGContext $$$$$$$$$$$$$$$$$\n"); - RDebug::Printf(" $$$$$$$$$$$$$ In eglvgGetCurrentVGContext,Thread Id %Lu $$$$$$$$$$$$$ ",(RThread().Id()));*/ - - if (egl) { RIEGLThread* thread = egl->getCurrentThread(); - //RDebug::Printf(" $$$$$$$$$$$$$ I am in function eglvgGetCurrentVGContext.EGL addr is %x = \n",egl); if (thread) { RI_ASSERT(thread->getCurrentContext() && thread->getCurrentSurface()); @@ -1581,9 +1555,6 @@ vgctx = RI_NEW(OpenVGRI::VGContext, (share_context ? ((RIEGLContext*)share_context)->getVGContext() : NULL)); //throws bad_alloc c = RI_NEW(RIEGLContext, (vgctx, config)); //throws bad_alloc - - RDebug::Printf(" ---------------------------- In eglCreateContext,VGContext addr is %x $$$$$$$$$$$$$ ",vgctx); - RDebug::Printf(" ---------------------------- In eglCreateContext,RIEGLContext addr is %x $$$$$$$$$$$$$ ",c); c->addReference(); display->addContext(c); //throws bad_alloc } @@ -1705,7 +1676,6 @@ EGL_RETURN(EGL_BAD_ALLOC, EGL_FALSE); newThread->makeCurrent(c, s); Drawable* temp = s->getDrawable(); - RDebug::Printf(" ------------------------------ In Drawable* temp,Drawable addr is %x $$$$$$$$$$$$$ ",temp); c->getVGContext()->setDefaultDrawable(s->getDrawable()); try