From: Jan Olszak Date: Tue, 11 Dec 2012 12:02:17 +0000 (+0100) Subject: [Prevent] Handle unhandled exceptions in wrt-client. X-Git-Tag: 2.1b_release~22^2~178 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9b1e184f0c21fe421ebfa3c6b2f9cb054497e1b5;p=platform%2Fframework%2Fweb%2Fwrt.git [Prevent] Handle unhandled exceptions in wrt-client. [Issue#] Unhandled exceptions propagate to main(). [Bug] N/A [Cause] N/A [Solution] Catch all exceptions and log them. [Verification] Build wrt. Change-Id: Ifc4d4d9fbb773e23e3f6faba0e8766fc670eb0e2 --- diff --git a/src/wrt-client/wrt-client.cpp b/src/wrt-client/wrt-client.cpp index b3ca80c..8ca5f02 100644 --- a/src/wrt-client/wrt-client.cpp +++ b/src/wrt-client/wrt-client.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -738,42 +739,46 @@ void WrtClient::Quit() int main(int argc, char *argv[]) { - ADD_PROFILING_POINT("main-entered", "point"); - - // Output on stdout will be flushed after every newline character, - // even if it is redirected to a pipe. This is useful for running - // from a script and parsing output. - // (Standard behavior of stdlib is to use full buffering when - // redirected to a pipe, which means even after an end of line - // the output may not be flushed). - setlinebuf(stdout); + UNHANDLED_EXCEPTION_HANDLER_BEGIN + { + ADD_PROFILING_POINT("main-entered", "point"); + + // Output on stdout will be flushed after every newline character, + // even if it is redirected to a pipe. This is useful for running + // from a script and parsing output. + // (Standard behavior of stdlib is to use full buffering when + // redirected to a pipe, which means even after an end of line + // the output may not be flushed). + setlinebuf(stdout); - // set evas backend type - if (!getenv("ELM_ENGINE")) { - if (!setenv("ELM_ENGINE", "gl", 1)) { - LogDebug("Enable backend"); + // set evas backend type + if (!getenv("ELM_ENGINE")) { + if (!setenv("ELM_ENGINE", "gl", 1)) { + LogDebug("Enable backend"); + } + } + else { + LogDebug("ELM_ENGINE : " << getenv("ELM_ENGINE")); } - } - else { - LogDebug("ELM_ENGINE : " << getenv("ELM_ENGINE")); - } -#ifndef TIZEN_PUBLIC - setenv("COREGL_FASTPATH", "1", 1); -#endif - setenv("CAIRO_GL_COMPOSITOR", "msaa", 1); - setenv("CAIRO_GL_LAZY_FLUSHING", "yes", 1); - setenv("ELM_IMAGE_CACHE", "0", 1); + #ifndef TIZEN_PUBLIC + setenv("COREGL_FASTPATH", "1", 1); + #endif + setenv("CAIRO_GL_COMPOSITOR", "msaa", 1); + setenv("CAIRO_GL_LAZY_FLUSHING", "yes", 1); + setenv("ELM_IMAGE_CACHE", "0", 1); - // Set log tagging - DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-CLIENT"); + // Set log tagging + DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-CLIENT"); - WrtClient app(argc, argv); + WrtClient app(argc, argv); - ADD_PROFILING_POINT("Before appExec", "point"); - int ret = app.Exec(); - LogDebug("App returned: " << ret); - ret = app.getReturnStatus(); - LogDebug("WrtClient returned: " << ret); - return ret; + ADD_PROFILING_POINT("Before appExec", "point"); + int ret = app.Exec(); + LogDebug("App returned: " << ret); + ret = app.getReturnStatus(); + LogDebug("WrtClient returned: " << ret); + return ret; + } + UNHANDLED_EXCEPTION_HANDLER_END }