diff options
| -rw-r--r-- | src/notification_proxy.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/notification_proxy.c b/src/notification_proxy.c index dba42db..4b028f6 100644 --- a/src/notification_proxy.c +++ b/src/notification_proxy.c | |||
| @@ -114,6 +114,7 @@ LIBIMOBILEDEVICE_API np_error_t np_client_start_service(idevice_t device, np_cli | |||
| 114 | LIBIMOBILEDEVICE_API np_error_t np_client_free(np_client_t client) | 114 | LIBIMOBILEDEVICE_API np_error_t np_client_free(np_client_t client) |
| 115 | { | 115 | { |
| 116 | plist_t dict; | 116 | plist_t dict; |
| 117 | property_list_service_client_t parent; | ||
| 117 | 118 | ||
| 118 | if (!client) | 119 | if (!client) |
| 119 | return NP_E_INVALID_ARG; | 120 | return NP_E_INVALID_ARG; |
| @@ -123,12 +124,16 @@ LIBIMOBILEDEVICE_API np_error_t np_client_free(np_client_t client) | |||
| 123 | property_list_service_send_xml_plist(client->parent, dict); | 124 | property_list_service_send_xml_plist(client->parent, dict); |
| 124 | plist_free(dict); | 125 | plist_free(dict); |
| 125 | 126 | ||
| 127 | parent = client->parent; | ||
| 128 | /* notifies the client->notifier thread that it should terminate */ | ||
| 129 | client->parent = NULL; | ||
| 130 | |||
| 126 | if (client->notifier) { | 131 | if (client->notifier) { |
| 127 | debug_info("joining np callback"); | 132 | debug_info("joining np callback"); |
| 128 | thread_join(client->notifier); | 133 | thread_join(client->notifier); |
| 129 | } else { | 134 | } else { |
| 130 | dict = NULL; | 135 | dict = NULL; |
| 131 | property_list_service_receive_plist(client->parent, &dict); | 136 | property_list_service_receive_plist(parent, &dict); |
| 132 | if (dict) { | 137 | if (dict) { |
| 133 | #ifndef STRIP_DEBUG_CODE | 138 | #ifndef STRIP_DEBUG_CODE |
| 134 | char *cmd_value = NULL; | 139 | char *cmd_value = NULL; |
| @@ -150,8 +155,7 @@ LIBIMOBILEDEVICE_API np_error_t np_client_free(np_client_t client) | |||
| 150 | } | 155 | } |
| 151 | } | 156 | } |
| 152 | 157 | ||
| 153 | property_list_service_client_free(client->parent); | 158 | property_list_service_client_free(parent); |
| 154 | client->parent = NULL; | ||
| 155 | 159 | ||
| 156 | mutex_destroy(&client->mutex); | 160 | mutex_destroy(&client->mutex); |
| 157 | free(client); | 161 | free(client); |
