[Prevent] Handle unhandled exceptions in wrt-popup.
authorJan Olszak <j.olszak@samsung.com>
Mon, 17 Dec 2012 07:34:14 +0000 (08:34 +0100)
committerGerrit Code Review <gerrit2@kim11>
Tue, 18 Dec 2012 08:53:44 +0000 (17:53 +0900)
[Issue] Unhandled exceptions propagate to main().
[Bug] N/A
[Cause] N/A
[Solution] Catch all exceptions and log them.
[Verification] Build wrt-popup.

Change-Id: Id9a1dc6e6162208fda88df7bc7955cc78c6d7e48

src/wrt-popup/wrt/popup-bin/wrt-popup.cpp

index a97d9c3..3023302 100644 (file)
@@ -180,17 +180,21 @@ WrtPopup::~WrtPopup()
 
 int main(int argc, char *argv[])
 {
-    // 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);
-
-    DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-POPUP");
-    Wrt::Popup::WrtPopup app(argc, argv);
-    int ret = app.Exec();
-    LogDebug("App returned: " << ret);
-    return ret;
+    UNHANDLED_EXCEPTION_HANDLER_BEGIN
+    {
+        // 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);
+
+        DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-POPUP");
+        Wrt::Popup::WrtPopup app(argc, argv);
+        int ret = app.Exec();
+        LogDebug("App returned: " << ret);
+        return ret;
+    }
+    UNHANDLED_EXCEPTION_HANDLER_END
 }