libds-mock: initialize member variables and add exception code @ constructor of MockW... 53/241853/1
authorSung-Jin Park <sj76.park@samsung.com>
Wed, 19 Aug 2020 04:12:56 +0000 (13:12 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 20 Aug 2020 10:12:11 +0000 (19:12 +0900)
Change-Id: I7ac66ef93fce9a08b3e5bbacd48079c7b44e00f5
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
tests/libds-mock.h

index 6bd23ef..ac77287 100644 (file)
@@ -40,13 +40,19 @@ class MockWaylandCompositor : public DSObject
 {
 public:
        MockWaylandCompositor()
-               : surfaceCreated(false)
+               : surfaceCreated(false),
+                 surfaceCommitted(false),
+                 __waylandSurface(nullptr)
        {
                __eventLoop = DSEventLoop::getInstance();
 
                __waylandCompositor = DSWaylandCompositor::getInstance();
-               __waylandCompositor->create();
-               __waylandCompositor->registerCallbackSurfaceCreated(this, std::bind(&MockWaylandCompositor::onSurfaceCreated, this, std::placeholders::_1));
+
+               if (__waylandCompositor)
+               {
+                       __waylandCompositor->create();
+                       __waylandCompositor->registerCallbackSurfaceCreated(this, std::bind(&MockWaylandCompositor::onSurfaceCreated, this, std::placeholders::_1));
+               }
        }
 
        ~MockWaylandCompositor()