fix MonitorLoop infinite restart, add getTexture NULL-safety, disable crash recovery
This commit is contained in:
parent
c25d5dd56d
commit
6ca913c4e3
|
|
@ -1230,7 +1230,7 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
|
|||
}
|
||||
|
||||
if (plvalue) {
|
||||
fprintf(stderr, "TRACE: convert entry key=%s\n", entry->key ? entry->key : "(null)");
|
||||
fprintf(stderr, "TRACE: convert entry key=%s convert=%p plvalue=%p\n", entry->key ? entry->key : "(null)", (void*)entry->convert, (void*)plvalue);
|
||||
/* convert data */
|
||||
if ((*entry->convert) (scr, entry, plvalue, entry->addr, &tdata)) {
|
||||
/*
|
||||
|
|
@ -1660,12 +1660,15 @@ static int getEnum(WScreen * scr, WDefaultEntry * entry, WMPropList * value, voi
|
|||
|
||||
static WTexture *parse_texture(WScreen * scr, WMPropList * pl)
|
||||
{
|
||||
fprintf(stderr, "TRACE: parse_texture pl=%p\n", (void*)pl);
|
||||
WMPropList *elem;
|
||||
char *val;
|
||||
int nelem;
|
||||
WTexture *texture = NULL;
|
||||
|
||||
fprintf(stderr, "TRACE: parse_texture before WMGetPropListItemCount\n");
|
||||
nelem = WMGetPropListItemCount(pl);
|
||||
fprintf(stderr, "TRACE: parse_texture nelem=%d\n", nelem);
|
||||
if (nelem < 1)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -1969,16 +1972,24 @@ static WTexture *parse_texture(WScreen * scr, WMPropList * pl)
|
|||
|
||||
static int getTexture(WScreen * scr, WDefaultEntry * entry, WMPropList * value, void *addr, void **ret)
|
||||
{
|
||||
fprintf(stderr, "TRACE: getTexture called value=%p\n", (void*)value);
|
||||
static WTexture *texture;
|
||||
int changed = 0;
|
||||
if (!value)
|
||||
return False;
|
||||
|
||||
again:
|
||||
if (!WMIsPLArray(value)) {
|
||||
fprintf(stderr, "TRACE: getTexture again value=%p\n", (void*)value);
|
||||
if (!value)
|
||||
return False;
|
||||
Bool _is_arr = WMIsPLArray(value);
|
||||
fprintf(stderr, "TRACE: getTexture WMIsPLArray returned %d\n", (int)_is_arr);
|
||||
if (!_is_arr) {
|
||||
wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry->key, "Texture");
|
||||
if (changed == 0) {
|
||||
value = entry->plvalue;
|
||||
if (!value) {
|
||||
wwarning(_("no default plvalue for %s, skipping"), entry->key);
|
||||
return False;
|
||||
}
|
||||
changed = 1;
|
||||
wwarning(_("using default \"%s\" instead"), entry->default_value);
|
||||
goto again;
|
||||
|
|
@ -2002,9 +2013,11 @@ static int getTexture(WScreen * scr, WDefaultEntry * entry, WMPropList * value,
|
|||
}
|
||||
}
|
||||
|
||||
texture = parse_texture(scr, value);
|
||||
fprintf(stderr, "TRACE: getTexture before parse_texture\n");
|
||||
texture = parse_texture(scr, value);
|
||||
fprintf(stderr, "TRACE: getTexture after parse_texture\n");
|
||||
|
||||
if (!texture) {
|
||||
if (!texture) {
|
||||
wwarning(_("Error in texture specification for key \"%s\""), entry->key);
|
||||
if (changed == 0) {
|
||||
value = entry->plvalue;
|
||||
|
|
|
|||
|
|
@ -107,19 +107,10 @@ int MonitorLoop(int argc, char **argv)
|
|||
(WTERMSIG(status) == SIGSEGV ||
|
||||
WTERMSIG(status) == SIGBUS ||
|
||||
WTERMSIG(status) == SIGILL || WTERMSIG(status) == SIGABRT || WTERMSIG(status) == SIGFPE)) {
|
||||
/* If so, we check when was the last restart.
|
||||
* If it was less than 3s ago, it's a bad sign, so we show
|
||||
* the crash panel and ask the user what to do */
|
||||
if (time(NULL) - last_start < 3) {
|
||||
if (showCrashDialog(WTERMSIG(status)) == 0) {
|
||||
wfree(child_argv);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
wwarning(_("Window Maker exited due to a crash (signal %i) and will be restarted."),
|
||||
wwarning(_("Window Maker exited due to a crash (signal %i) — exiting"),
|
||||
WTERMSIG(status));
|
||||
} else
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
wfree(child_argv);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue