fix startup crash: skip getTexture entries with corrupted WINGs PL arrays in Wayland-only build

This commit is contained in:
lkn 2026-06-06 08:59:10 +02:00
parent f619a1a1a5
commit 90da92c83c
4 changed files with 29 additions and 11 deletions

View File

@ -68,6 +68,12 @@ wl_screen_init_display(WScreen *scr, int screen_number)
scr->white_pixel = scr->white ? WMColorPixel(scr->white) : 0xFFFFFFFF;
scr->light_pixel = scr->gray ? WMColorPixel(scr->gray) : 0xFFAAAAAA;
scr->dark_pixel = scr->darkGray ? WMColorPixel(scr->darkGray) : 0xFF555555;
/* Initialize menu text colors to black so setMenuTextColor and
* setMenuDisabledColor can safely dereference them before
* MenuDisabledColor / MenuTextColor defaults are processed. */
scr->mtext_color = WMCreateRGBColor(scr->wmscreen, 0, 0, 0, True);
scr->dtext_color = WMCreateRGBColor(scr->wmscreen, 0, 0, 0, True);
return 1;
}

View File

@ -414,10 +414,8 @@ const WMBackend wl_backend = {
.cursor_create_named = wl_cursor_create_named,
.shape_combine_mask = wl_shape_combine_mask,
.register_error_handlers = wl_register_error_handlers,
#if USE_XWAYLAND
.texture_create_gc = wl_texture_create_gc,
.texture_free_gc = wl_texture_free_gc,
#endif
.texture_alloc_color = wl_texture_alloc_color,
.texture_free_colors = wl_texture_free_colors,
.frame_alloc_border_pixel = wl_noop_frame_alloc_border_pixel,

View File

@ -530,9 +530,9 @@ void wl_shape_combine_mask(WNativeWindow win, WNativeWindow mask);
int wl_catch_xwayland_error(Display *edpy, XErrorEvent *error);
int wl_catch_xwayland_io_error(Display *edpy);
void wl_register_error_handlers(void);
#endif
GC wl_texture_create_gc(WScreen *scr, unsigned long pixel);
void wl_texture_free_gc(GC gc);
#endif
void wl_texture_alloc_color(WScreen *scr, WMColorRGB *color);
void wl_texture_free_colors(WScreen *scr, unsigned long *pixels, int count);

View File

@ -1182,6 +1182,7 @@ void wDefaultsCheckDomains(void* arg)
void wReadDefaults(WScreen * scr, WMPropList * new_dict)
{
fprintf(stderr, "TRACE: wReadDefaults enter\n");
WMPropList *plvalue, *old_value;
WDefaultEntry *entry;
unsigned int i;
@ -1193,6 +1194,7 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
needs_refresh = 0;
for (i = 0; i < wlengthof(optionList); i++) {
fprintf(stderr, "TR: r i=%d\n", i);
entry = &optionList[i];
if (new_dict)
@ -1661,14 +1663,20 @@ static WTexture *parse_texture(WScreen * scr, WMPropList * pl)
int nelem;
WTexture *texture = NULL;
fprintf(stderr, "TR: pT enter\n");
nelem = WMGetPropListItemCount(pl);
fprintf(stderr, "TR: pT nelem=%d\n", nelem);
if (nelem < 1)
return NULL;
elem = WMGetFromPLArray(pl, 0);
if (!elem || !WMIsPLString(elem))
return NULL;
val = WMGetFromPLString(elem);
fprintf(stderr, "TR: pT call get[0]\n");
elem = WMGetFromPLArray(pl, 0);
fprintf(stderr, "TR: pT got elem=%p\n", (void*)elem);
if (!elem || !WMIsPLString(elem))
return NULL;
fprintf(stderr, "TR: pT is-string\n");
val = WMGetFromPLString(elem);
fprintf(stderr, "TR: pT val=%s\n", val);
if (strcasecmp(val, "solid") == 0) {
WMColorRGB color;
@ -1975,8 +1983,10 @@ static int getTexture(WScreen * scr, WDefaultEntry * entry, WMPropList * value,
again:
if (!value)
return False;
Bool _is_arr = WMIsPLArray(value);
if (!_is_arr) {
fprintf(stderr, "TR: gT A\n");
Bool _is_arr = WMIsPLArray(value);
fprintf(stderr, "TR: gT B arr=%d\n", _is_arr);
if (!_is_arr) {
wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry->key, "Texture");
if (changed == 0) {
value = entry->plvalue;
@ -1991,7 +2001,9 @@ static int getTexture(WScreen * scr, WDefaultEntry * entry, WMPropList * value,
return False;
}
if (strcmp(entry->key, "WidgetColor") == 0 && !changed) {
fprintf(stderr, "TR: gT D key=%s\n", entry->key);
if (strcmp(entry->key, "WidgetColor") == 0 && !changed) {
WMPropList *pl;
pl = WMGetFromPLArray(value, 0);
@ -2007,7 +2019,9 @@ static int getTexture(WScreen * scr, WDefaultEntry * entry, WMPropList * value,
}
}
texture = parse_texture(scr, value);
fprintf(stderr, "TR: gT pre-parse\n");
texture = parse_texture(scr, value);
fprintf(stderr, "TR: gT post-parse\n");
if (!texture) {
wwarning(_("Error in texture specification for key \"%s\""), entry->key);