[DF181219-00478] Add deinitialize logic for crash 45/196245/1 accepted/tizen/unified/20181227.062042 submit/tizen/20181226.112551
authorJihoon Jung <jh8801.jung@samsung.com>
Wed, 26 Dec 2018 11:18:26 +0000 (20:18 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Wed, 26 Dec 2018 11:20:07 +0000 (20:20 +0900)
Change-Id: I58981785f3506d55367ea3b865ac190cc2ad40ea

packaging/mtp-initiator.spec
src/daemon/mtp_daemon.c [changed mode: 0644->0755]
src/daemon/mtp_daemon_event.c

index 45a9390b0b9adeb8142177ff8622af52ff962523..4c9d49278cfb5f0fcd78e99b54207bb18ccb9a6d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mtp-initiator
 Summary:    mtp(media transfer protocol) initiator
-Version:    1.4.32
+Version:    1.4.33
 Release:    0
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
old mode 100644 (file)
new mode 100755 (executable)
index ab00177..76ca83e
@@ -81,8 +81,6 @@ static mtp_error_e __daemon_deinitalize(mtp_context *mtp_ctx)
        if (ret != MTP_ERROR_NONE)
                return ret;
 
-       mtp_ctx->is_running = false;
-
        if (mtp_ctx->c_thread != NULL) {
                g_thread_join(mtp_ctx->c_thread);
                g_thread_unref(mtp_ctx->c_thread);
@@ -181,6 +179,8 @@ int main(int argc, char *argv[])
        g_main_loop_run(mtp_ctx->main_loop);
 
 EXIT:
+       g_thread_pool_free(mtp_ctx->device_list->threads, true, true);
+
        /* LCOV_EXCL_START */
        ret = __daemon_deinitalize(mtp_ctx);
        if (ret != MTP_ERROR_NONE)
index 43a8e24ee58c884322f557fec6175a054adf3156..49834fe63ede83fafcb142cfdf0001a52967e651 100755 (executable)
@@ -168,6 +168,7 @@ int __usb_host_status_changed_cb(struct libusb_context *ctx,
 
        if (mtp_ctx->device_list->device_num == 0) {
                mtp_daemon_gdbus_emit_event(MTP_INITIATOR_EVENT_TURNED_OFF, 0, mtp_ctx);
+               mtp_ctx->is_running = false;
                g_main_loop_quit(mtp_ctx->main_loop);
        }
 
@@ -325,9 +326,8 @@ static gpointer __dispatch_event(gpointer user_data)
        }
 
        MTP_LOGE("dispatch thread created");
-       struct timeval tv = {0, 200000};
        while (mtp_ctx->is_running) {
-               libusb_handle_events_timeout_completed(mtp_ctx->usb_ctx, &tv, NULL);
+               libusb_handle_events_completed(mtp_ctx->usb_ctx, NULL);
        }
 
        g_thread_exit(NULL);