/quit now exits from the event loop
Before this change issuing `/quit` directly called `exit(0)` and did not invoke all the graceful shutdown routines. Now we first try to exit from the event loop, which includes cleaning up everything. In case the event loop is stuck for some reason, you could try to issue a second `/quit`, which will then directly call `exit(0)`. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -1328,7 +1328,8 @@ gboolean
|
||||
cmd_quit(ProfWin* window, const char* const command, gchar** args)
|
||||
{
|
||||
log_info("Profanity is shutting down…");
|
||||
exit(0);
|
||||
if (prof_set_quit())
|
||||
exit(0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,10 +134,12 @@ prof_run(char* log_level, char* account_name, char* config_file, char* log_file,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
prof_set_quit(void)
|
||||
{
|
||||
gboolean ret = force_quit;
|
||||
force_quit = TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
void prof_run(char* log_level, char* account_name, char* config_file, char* log_file, char* theme_name);
|
||||
void prof_set_quit(void);
|
||||
gboolean prof_set_quit(void);
|
||||
|
||||
extern pthread_mutex_t lock;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user