Commit 5c8b3b7d authored by Vincent Hourdin's avatar Vincent Hourdin
Browse files

starting two scripts from @ in succession, fixed #796

parent da080c48
......@@ -189,6 +189,7 @@ gpointer execute_script(gpointer p) {
com.script = TRUE;
com.stop_script = FALSE;
com.script_thread_exited = FALSE;
gettimeofday(&t_start, NULL);
......@@ -276,8 +277,10 @@ gpointer execute_script(gpointer p) {
}
g_free(saved_cwd);
if (com.script_thread)
if (com.script_thread) {
siril_debug_print("Script thread exiting\n");
com.script_thread_exited = TRUE;
}
return GINT_TO_POINTER(retval);
}
......@@ -417,10 +420,12 @@ int processcommand(const char *line) {
if (line[0] == '\0' || line[0] == '\n')
return 0;
if (line[0] == '@') { // case of files
if (get_thread_run() || get_script_thread_run()) {
if (get_thread_run() || (get_script_thread_run() && !com.script_thread_exited)) {
PRINT_ANOTHER_THREAD_RUNNING;
return 1;
}
if (get_script_thread_run())
wait_for_script_thread();
/* Switch to console tab */
control_window_switch_to_tab(OUTPUT_LOGS);
......
......@@ -125,6 +125,7 @@ gboolean reserve_thread();
void unreserve_thread();
gboolean get_script_thread_run();
void wait_for_script_thread();
gboolean end_generic(gpointer arg);
guint siril_add_idle(GSourceFunc idle_function, gpointer data);
......
......@@ -720,6 +720,7 @@ struct cominf {
gboolean script; // scripts execution
gboolean stop_script; // abort script execution
GThread *script_thread; // reads a script and executes its commands
gboolean script_thread_exited; // boolean set by the script thread when it exits
rectangle selection; // coordinates of the selection rectangle
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment