]> 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:00 +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.

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

index 0cf616f74d371d35ff586a59cf90d80d101616c5..2203011b840ca07df29fe6e93447620e325c0634 100644 (file)
@@ -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);
 
index 58e9da11ca63968b467ca21684258f4dbbc8cad1..dc6f426f985d37154b4d324f828667f70a603dd8 100644 (file)
@@ -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)
index 63598f9cad6c81c3f17d2625276110656ae623d2..6cf0779f90afb11d814fc4023a3a27c299169e1d 100644 (file)
@@ -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;
 }