[0.6.242] Check MMPLAYER_BUS_WATCHER_WAIT_UNTIL() return value, when remove bus watcher
[platform/core/multimedia/libmm-player.git] / src / mm_player_priv.c
index c90a9e0..ec122c6 100644 (file)
@@ -802,10 +802,14 @@ _mmplayer_bus_watcher_remove(MMHandleType hplayer)
                __mmplayer_remove_g_source_from_context(player->context.thread_default, player->bus_watcher);
                MMPLAYER_BUS_WATCHER_LOCK(player);
                end_time = g_get_monotonic_time () + 2 * G_TIME_SPAN_SECOND;
-               while (player->bus_watcher > 0)
-                       MMPLAYER_BUS_WATCHER_WAIT_UNTIL(player, end_time);
+               while (player->bus_watcher > 0) {
+                       if (!MMPLAYER_BUS_WATCHER_WAIT_UNTIL(player, end_time)) {
+                               LOGW("MMPLAYER_BUS_WATCHER_WAIT_UNTIL() timeout has passed - bus_watcher (%d)",
+                                               player->bus_watcher);
+                               break;
+                       }
+               }
                MMPLAYER_BUS_WATCHER_UNLOCK(player);
-
                g_mutex_clear(&player->bus_watcher_mutex);
                g_cond_clear(&player->bus_watcher_cond);
        }