DSWaylandPointer: fix crash at the constructor and setFocus() 40/241840/1
authorSung-Jin Park <sj76.park@samsung.com>
Tue, 18 Aug 2020 07:25:56 +0000 (16:25 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 20 Aug 2020 10:11:59 +0000 (19:11 +0900)
Change-Id: Iaa6352dc3e4f391fa2135085dc3552afc981678e
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
src/DSWaylandServer/DSWaylandPointer.cpp

index dea562f..4ae9813 100644 (file)
@@ -36,7 +36,7 @@ DSWaylandPointerPrivate::DSWaylandPointerPrivate(DSWaylandSeat *seat, DSWaylandP
        : DSObjectPrivate(pointer),
          __p_ptr(pointer),
          __seat(seat),
-         __compositor(seat->getCompositor()),
+         __compositor(seat ? (seat->getCompositor()) : nullptr),
          __waylandSurface(nullptr),
          __wlPointerResource(nullptr)
 {
@@ -61,7 +61,7 @@ void DSWaylandPointerPrivate::setFocus(DSWaylandSurface *waylandSurface)
 
        __waylandSurface = waylandSurface;
 
-       if (!waylandSurface)
+       if (!waylandSurface || !waylandSurface->hasResource())
        {
                __wlPointerResource = nullptr;
                DSLOG_INF("DSWaylandPointerPrivate", "wlPointerResource has been set to null.");