From: John Stebbins Date: Thu, 12 Jul 2018 22:22:06 +0000 (-0700) Subject: LinGui: fix queue reload in flatpak sandbox X-Git-Tag: 1.2.0~235 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b44cc7808d3d1e185a0ed517ac7d485e92cca93;p=handbrake LinGui: fix queue reload in flatpak sandbox Queues are tied to the PID of the process that wrote them. But the app runs with the same PID in the sandbox on every invocation. So the new pid file must be written after processing any previous queue. --- diff --git a/gtk/src/main.c b/gtk/src/main.c index 0cf616f74..2203011b8 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -993,8 +993,6 @@ ghb_activate_cb(GApplication * app, signal_user_data_t * ud) ghb_override_user_config_dir(arg_config_dir); } - ghb_write_pid_file(); - // map application actions (menu callbacks) map_actions(app, ud); diff --git a/gtk/src/presets.c b/gtk/src/presets.c index 58e9da11c..dc6f426f9 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -871,16 +871,9 @@ ghb_find_pid_file() if (strncmp(file, "ghb.pid.", 8) == 0) { gchar *path; - pid_t my_pid; int pid; sscanf(file, "ghb.pid.%d", &pid); - my_pid = getpid(); - if (my_pid == pid) - { - file = g_dir_read_name(gdir); - continue; - } path = g_strdup_printf("%s/%s", config, file); #if !defined(_WIN32) diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index 63598f9ca..6cf0779f9 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -2474,7 +2474,7 @@ ghb_reload_queue(signal_user_data_t *ud) find_pid: pid = ghb_find_pid_file(); if (pid < 0) - return FALSE; + goto done; queue = ghb_load_old_queue(pid); ghb_remove_old_queue_file(pid); @@ -2521,6 +2521,10 @@ find_pid: ghb_save_queue(ud->queue); ghb_update_pending(ud); } + +done: + ghb_write_pid_file(); + return FALSE; }