summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2018-07-12 15:22:06 -0700
committerJohn Stebbins <[email protected]>2018-07-12 15:25:00 -0700
commit9b44cc7808d3d1e185a0ed517ac7d485e92cca93 (patch)
tree9d36863472519b993f163c292e0223d142005d07 /gtk
parentbee4ee46f670297aa33acc75ff5fa2332a39a792 (diff)
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.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/main.c2
-rw-r--r--gtk/src/presets.c7
-rw-r--r--gtk/src/queuehandler.c6
3 files changed, 5 insertions, 10 deletions
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;
}