mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Fix signal handlers
This commit is contained in:
parent
065ca5f6d3
commit
a7fb568aff
2 changed files with 61 additions and 0 deletions
|
|
@ -176,6 +176,8 @@ func (a *linuxApp) monitorThemeChanges() {
|
|||
}
|
||||
|
||||
func newPlatformApp(parent *App) *linuxApp {
|
||||
|
||||
C.install_signal_handlers()
|
||||
name := strings.ToLower(strings.Replace(parent.options.Name, " ", "", -1))
|
||||
if name == "" {
|
||||
name = "undefined"
|
||||
|
|
|
|||
|
|
@ -145,6 +145,65 @@ typedef struct Screen {
|
|||
bool isPrimary;
|
||||
} Screen;
|
||||
|
||||
// CREDIT: https://github.com/rainycape/magick
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static void fix_signal(int signum) {
|
||||
struct sigaction st;
|
||||
|
||||
if (sigaction(signum, NULL, &st) < 0) {
|
||||
goto fix_signal_error;
|
||||
}
|
||||
st.sa_flags |= SA_ONSTACK;
|
||||
if (sigaction(signum, &st, NULL) < 0) {
|
||||
goto fix_signal_error;
|
||||
}
|
||||
return;
|
||||
fix_signal_error:
|
||||
fprintf(stderr, "error fixing handler for signal %d, please "
|
||||
"report this issue to "
|
||||
"https://github.com/wailsapp/wails: %s\n",
|
||||
signum, strerror(errno));
|
||||
}
|
||||
|
||||
static void install_signal_handlers() {
|
||||
#if defined(SIGCHLD)
|
||||
fix_signal(SIGCHLD);
|
||||
#endif
|
||||
#if defined(SIGHUP)
|
||||
fix_signal(SIGHUP);
|
||||
#endif
|
||||
#if defined(SIGINT)
|
||||
fix_signal(SIGINT);
|
||||
#endif
|
||||
#if defined(SIGQUIT)
|
||||
fix_signal(SIGQUIT);
|
||||
#endif
|
||||
#if defined(SIGABRT)
|
||||
fix_signal(SIGABRT);
|
||||
#endif
|
||||
#if defined(SIGFPE)
|
||||
fix_signal(SIGFPE);
|
||||
#endif
|
||||
#if defined(SIGTERM)
|
||||
fix_signal(SIGTERM);
|
||||
#endif
|
||||
#if defined(SIGBUS)
|
||||
fix_signal(SIGBUS);
|
||||
#endif
|
||||
#if defined(SIGSEGV)
|
||||
fix_signal(SIGSEGV);
|
||||
#endif
|
||||
#if defined(SIGXCPU)
|
||||
fix_signal(SIGXCPU);
|
||||
#endif
|
||||
#if defined(SIGXFSZ)
|
||||
fix_signal(SIGXFSZ);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int GetNumScreens(){
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue