From 143e1e22333cfcaa5371d7a671ba0b5e51e1499d Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Sun, 12 Nov 2017 08:45:21 -0800 Subject: LinGui: don't free uninitialized things on exit --- gtk/src/hb-backend.c | 9 ++++++--- gtk/src/main.c | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'gtk/src') diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index c2a2e556e..126146cd3 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -3207,9 +3207,12 @@ ghb_log_level_set(int level) void ghb_backend_close() { - hb_close(&h_live); - hb_close(&h_queue); - hb_close(&h_scan); + if (h_live != NULL) + hb_close(&h_live); + if (h_queue != NULL) + hb_close(&h_queue); + if (h_scan != NULL) + hb_close(&h_scan); hb_global_close(); } diff --git a/gtk/src/main.c b/gtk/src/main.c index 8270a58f5..f3f8e1523 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -1343,21 +1343,24 @@ main(int argc, char *argv[]) ghb_backend_close(); // Remove stderr redirection - g_source_remove(ud->stderr_src_id); + if (ud->stderr_src_id > 0) + g_source_remove(ud->stderr_src_id); ghb_value_free(&ud->queue); ghb_value_free(&ud->settings_array); ghb_value_free(&ud->prefs); ghb_value_free(&ud->globals); ghb_value_free(&ud->x264_priv); - g_io_channel_unref(ud->activity_log); + if (ud->activity_log != NULL) + g_io_channel_unref(ud->activity_log); ghb_settings_close(); ghb_resource_free(); #if !defined(_WIN32) notify_uninit(); #endif - g_object_unref(ud->builder); + if (ud->builder != NULL) + g_object_unref(ud->builder); g_free(ud->current_dvd_device); g_free(ud); -- cgit v1.2.3