]> granicus.if.org Git - handbrake/commitdiff
LinGui: fix queue reload in flatpak sandbox
authorJohn Stebbins <jstebbins.hb@gmail.com>
Thu, 12 Jul 2018 22:22:06 +0000 (15:22 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Thu, 12 Jul 2018 22:25:38 +0000 (15:25 -0700)
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.

(cherry picked from commit 9b44cc7808d3d1e185a0ed517ac7d485e92cca93)

gtk/src/main.c
gtk/src/presets.c
gtk/src/queuehandler.c

index abd8c6171d50faac7edfa24d9ac6bd42b43156dc..876d8265ae7ff9886e1715a4dce2955b9c1b1210 100644 (file)
@@ -1001,8 +1001,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);
 
index f5e6eabf92c7c5a3a0977e4be6ff6d57c2f848c7..b2ef25089243dcd5ed1a30b4831ddf419704b0ef 100644 (file)
@@ -876,16 +876,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)
index 74fbda2fc9aca8488306b9f13f45077f99fde8c4..8eaab15f46871069699becab42a9cfa7dd74682c 100644 (file)
@@ -2472,7 +2472,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);
@@ -2519,6 +2519,10 @@ find_pid:
         ghb_save_queue(ud->queue);
         ghb_update_pending(ud);
     }
+
+done:
+    ghb_write_pid_file();
+
     return FALSE;
 }