Release resources 13/256613/1
authorCheoleun Moon <chleun.moon@samsung.com>
Thu, 8 Apr 2021 06:05:44 +0000 (15:05 +0900)
committerCheoleun Moon <chleun.moon@samsung.com>
Thu, 8 Apr 2021 06:05:49 +0000 (15:05 +0900)
Change-Id: Ib1f5a133a57bad976e5e97dddeca7715ff302d7c
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
include/vine.h
src/vine-event-loop.cpp
src/vine-session.cpp

index 7e4ecac..068e248 100755 (executable)
@@ -414,6 +414,7 @@ int vine_session_unset_registered_cb(vine_session_h session);
 
 /**
  * @brief Called when service is discovered.
+ * @remarks @a service will be freed after this callback. Use @a vine_service_clone().
  * @since_tizen 6.5
  * @param[in] session The session handle
  * @param[in] discovered_service The discovered service
index e8f6a67..15e94d4 100644 (file)
@@ -154,7 +154,11 @@ void vine_event_queue_destroy(vine_event_queue_h event_fd)
 {
        vine_event_queue_s *event_fd_handle = (vine_event_queue_s *)event_fd;
 
-       //g_async_queue_unref(event_fd_handle->event_queue);
+       vine_event *event;
+       while ( (event = event_fd_handle->event_queue.pop()) != NULL) {
+               if (event->free_func)
+                       event->free_func(event->event_data);
+       }
        if (event_fd_handle->fd >= 0)
                close(event_fd_handle->fd);
        free(event_fd);
index 8faf6cf..20528bd 100755 (executable)
@@ -310,6 +310,8 @@ static void __discovered_cb(vine_disc_h disc, bool available,
 
        if (s->discovered_cb)
                s->discovered_cb(s, discovered_service, state, s->discovered_cb_data);
+
+       _vine_service_destroy(discovered_service);
 }
 
 int _vine_session_start_discovery(vine_session_h session,