Add comment to usb_host_destroy() 82/255982/1 accepted/tizen/unified/20210331.053944 submit/tizen/20210329.052634
authorINSUN PYO <insun.pyo@samsung.com>
Fri, 26 Mar 2021 02:07:41 +0000 (11:07 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Fri, 26 Mar 2021 02:07:41 +0000 (11:07 +0900)
Change-Id: Ib716a048b5d15bcdd5b5507c220261b1108cf462

src/usb_host.c

index d0f6eac97edb229de565774f91940ec52f0b0ea1..aaee1661a5bc8d29ddc06e3946f0c052453be2f2 100644 (file)
@@ -586,6 +586,14 @@ int usb_host_destroy(usb_host_context_h context)
                _I("removed fd %d", fd);
        }
 
+       /*
+        * libusb_exit() inernally calls fd_removed_cb() througth the callback of the
+        * "libusb_exit() -> usbi_io_exit() -> usbi_remove_poolfd() -> fd_removed_cb()" call path.
+        *
+        * The gloabl variable context is referenced in fd_removed_cb().
+        * So, libusb_exit() should be called before context is cleaned up.
+        *
+       */
        libusb_exit(context->lusb_ctx);
        g_list_free(context->gio_channels);
        pthread_mutex_destroy(&context->channel_list_lock);