Remove bind callback when Unbind called 45/245945/2
authorhyunho <hhstark.kang@samsung.com>
Tue, 20 Oct 2020 08:34:36 +0000 (17:34 +0900)
committerhyunho <hhstark.kang@samsung.com>
Tue, 20 Oct 2020 09:23:13 +0000 (18:23 +0900)
Change-Id: I2b22cc423269c9813d88a66ba1b27b3d82eb01d9
Signed-off-by: hyunho <hhstark.kang@samsung.com>
watch-holder/src/watch.cc

index 13212b2bc7a3e1e53888ec1cb2c7c1cfcb30ea50..4cfbb9d7acad517ad2ddd93a772112bdf784d349 100644 (file)
@@ -79,7 +79,7 @@ void Watch::BlockUpdate(bool enable) {
 
 void Watch::OnAuxMsg(void *data, Evas_Object *o, void *ev_info) {
   Watch* wa = (Watch*)data;
-  if (wa->bind_win_ == nullptr) {
+  if (wa == nullptr || wa->bind_win_ == nullptr) {
     LOGW("Null bind win");
     return;
   }
@@ -137,6 +137,10 @@ void Watch::Bind(Evas_Object* win) {
 void Watch::Unbind() {
   RemoteSurfaceEvas::Unbind();
   is_bound_ = false;
+  if (bind_win_ == nullptr)
+    return;
+  LOGW("Remove unbind callback");
+  evas_object_smart_callback_del(bind_win_, "aux,msg,received", OnAuxMsg);
 }
 
 Evas_Object* Watch::GetCurrentImage() const {