wayland: Phase 59 — guard SetupEnvironment rcontext NULL deref
scr->rcontext is NULL in the Wayland path (RContextCreate is only called under dpy). SetupEnvironment() is reachable via shell command launch and RelaunchWindow; wrap the WRASTER_COLOR_RESOLUTION putenv in a scr->rcontext NULL-check to prevent a crash. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b3acfb2366
commit
e82bb279ab
10
src/main.c
10
src/main.c
|
|
@ -269,10 +269,12 @@ void SetupEnvironment(WScreen * scr)
|
|||
strcat(tmp, buf);
|
||||
putenv(tmp);
|
||||
}
|
||||
tmp = wmalloc(60);
|
||||
snprintf(tmp, 60, "WRASTER_COLOR_RESOLUTION%i=%i", scr->screen,
|
||||
scr->rcontext->attribs->colors_per_channel);
|
||||
putenv(tmp);
|
||||
if (scr->rcontext) { /* Wayland: rcontext is NULL (no X11 colormap) */
|
||||
tmp = wmalloc(60);
|
||||
snprintf(tmp, 60, "WRASTER_COLOR_RESOLUTION%i=%i", scr->screen,
|
||||
scr->rcontext->attribs->colors_per_channel);
|
||||
putenv(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
Loading…
Reference in New Issue