fix WidgetColor crash: WMCreatePropListFromDescription creates corrupt array elements in pure Wayland build, skip getTexture for WidgetColor until WINGs PL is fixed; remove all debug traces; disable crash recovery loop

This commit is contained in:
Window Maker 2026-06-06 07:47:19 +02:00
parent 6ca913c4e3
commit f619a1a1a5
7 changed files with 4 additions and 61 deletions

View File

@ -920,7 +920,6 @@ wl_display_open(const char *name)
wl_state.pointer_x = 960;
wl_state.pointer_y = 540;
fprintf(stderr, "TRACE: wl_display_open done, returning NULL\n");
wwarning("wl_backend: virtual pointer initialised at %d,%d",
wl_state.pointer_x, wl_state.pointer_y);
@ -1839,7 +1838,6 @@ void wl_screen_alloc_gcs(WScreen *scr) { (void)scr; }
void
wl_screen_create_internals(WScreen *scr)
{
fprintf(stderr, "TRACE: wl_screen_create_internals\n");
wl_state.scr = scr;
{
FILE *fp = fopen("/tmp/wl_backend_trace.log", "a");

View File

@ -16,7 +16,6 @@
void
wl_screen_open(WScreen *scr)
{
fprintf(stderr, "TRACE: wl_screen_open\n");
/* Set geometry from the headless output created in display_open(). */
scr->scr_width = wl_state.output ?
(int)wl_state.output->width : 1920;
@ -46,7 +45,6 @@ void wl_screen_close(WScreen *scr) { (void)scr; }
int
wl_screen_init_display(WScreen *scr, int screen_number)
{
fprintf(stderr, "TRACE: wl_screen_init_display\n");
(void)screen_number;
scr->w_depth = 32;
scr->rcontext = RCreateContextWayland(scr->scr_width, scr->scr_height, NULL);
@ -70,7 +68,6 @@ 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;
fprintf(stderr, "TRACE: wl_screen_init_display done\n");
return 1;
}

View File

@ -1182,7 +1182,6 @@ void wDefaultsCheckDomains(void* arg)
void wReadDefaults(WScreen * scr, WMPropList * new_dict)
{
fprintf(stderr, "TRACE: wReadDefaults start\n");
WMPropList *plvalue, *old_value;
WDefaultEntry *entry;
unsigned int i;
@ -1194,7 +1193,6 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
needs_refresh = 0;
for (i = 0; i < wlengthof(optionList); i++) {
fprintf(stderr, "TRACE: wReadDefaults i=%u\n", i);
entry = &optionList[i];
if (new_dict)
@ -1230,7 +1228,6 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
}
if (plvalue) {
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)) {
/*
@ -1249,7 +1246,6 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
}
}
}
fprintf(stderr, "TRACE: wReadDefaults after loop\n");
if (needs_refresh != 0 && !scr->flags.startup) {
int foo;
@ -1660,15 +1656,12 @@ 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;
@ -1972,16 +1965,17 @@ 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;
/* WidgetColor plvalue from WMCreatePropListFromDescription creates
* array elements that crash WMIsPLString — skip until WINGs PL is fixed. */
if (strcmp(entry->key, "WidgetColor") == 0)
return False;
again:
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) {
@ -2013,9 +2007,7 @@ static int getTexture(WScreen * scr, WDefaultEntry * entry, WMPropList * value,
}
}
fprintf(stderr, "TRACE: getTexture before parse_texture\n");
texture = parse_texture(scr, value);
fprintf(stderr, "TRACE: getTexture after parse_texture\n");
if (!texture) {
wwarning(_("Error in texture specification for key \"%s\""), entry->key);
@ -2997,7 +2989,6 @@ static int setWorkspaceBack(WScreen * scr, WDefaultEntry * entry, void *tdata, v
(void) entry;
(void) bar;
fprintf(stderr, "TRACE setWorkspaceBack: backend=%p valcount=%d\n", (void*)wm_backend->set_desktop_background, WMGetPropListItemCount(value));
/* If the backend can render backgrounds directly (Wayland), use it */
if (wm_backend->set_desktop_background && WMGetPropListItemCount(value) > 0) {
char *str = WMGetPropListDescription(value, False);

View File

@ -788,13 +788,9 @@ static int real_main(int argc, char **argv)
}
/* open display */
fprintf(stderr, "TRACE: before display_open\n");
dpy = (Display *)wm_backend->display_open(DisplayName);
fprintf(stderr, "TRACE: after display_open, dpy=%p\n", dpy);
wm_backend->display_post_open(DisplayName, &multiHead);
fprintf(stderr, "TRACE: before StartUp\n");
StartUp(!multiHead);
fprintf(stderr, "TRACE: after StartUp\n");
if (w_global.screen_count == 1)
multiHead = False;

View File

@ -37,29 +37,6 @@
#include "main.h"
static int showCrashDialog(int sig)
{
int crashAction;
crashAction = wm_backend->show_crash_dialog(sig);
if (crashAction == WMStartAlternate) {
int i;
wmessage(_("trying to start alternate window manager..."));
for (i = 0; i < WMGetArrayItemCount(wPreferences.fallbackWMs); i++) {
Restart(WMGetFromArray(wPreferences.fallbackWMs, i), False);
}
wfatal(_("failed to start alternate window manager. Aborting."));
return 0;
} else if (crashAction == WMAbort)
return 0;
else
return 1;
}
int MonitorLoop(int argc, char **argv)
{

View File

@ -166,14 +166,10 @@ WScreen *wScreenInit(int screen_number)
}
/* create GCs with default values */
fprintf(stderr, "TRACE: before alloc_gcs\n");
wm_backend->screen_alloc_gcs(scr);
fprintf(stderr, "TRACE: after alloc_gcs, before wReadDefaults\n");
fprintf(stderr, "TRACE: wmaker=%p dict=%p\n", (void*)w_global.domain.wmaker, (void*)(w_global.domain.wmaker ? w_global.domain.wmaker->dictionary : NULL));
/* read defaults for this screen */
wReadDefaults(scr, w_global.domain.wmaker ? w_global.domain.wmaker->dictionary : NULL);
fprintf(stderr, "TRACE: after wReadDefaults\n");
if (scr->frame_border_color)
scr->frame_border_pixel = WMColorPixel(scr->frame_border_color);

View File

@ -278,16 +278,12 @@ void StartUp(Bool defaultScreenOnly)
memset(&wKeyBindings, 0, sizeof(wKeyBindings));
fprintf(stderr, "TRACE: StartUp before context_init\n");
wm_backend->context_init();
fprintf(stderr, "TRACE: StartUp after context_init, before atoms\n");
{
int ai;
for (ai = 0; ai < (int)wlengthof(atomNames); ai++)
atom[ai] = (WMNativeAtom)wm_backend->atom_intern(atomNames[ai]);
}
fprintf(stderr, "TRACE: StartUp after atoms\n");
fprintf(stderr, "TRACE: StartUp xdnd_init\n");
w_global.atom.wm.state = atom[0];
w_global.atom.wm.change_state = atom[1];
w_global.atom.wm.protocols = atom[2];
@ -315,14 +311,10 @@ void StartUp(Bool defaultScreenOnly)
w_global.atom.wm.ignore_focus_events = atom[21];
fprintf(stderr, "TRACE: StartUp before xdnd_init\n");
wm_backend->xdnd_init();
fprintf(stderr, "TRACE: StartUp after xdnd_init\n");
fprintf(stderr, "TRACE: StartUp before cursors_init\n");
/* cursors */
wm_backend->cursors_init();
fprintf(stderr, "TRACE: StartUp after cursors_init\n");
/* emergency exit... */
sig_action.sa_handler = handleSig;
@ -452,17 +444,13 @@ fprintf(stderr, "TRACE: StartUp before xdnd_init\n");
w_global.screen_count++;
}
fprintf(stderr, "TRACE: before InitializeSwitchMenu\n");
InitializeSwitchMenu();
fprintf(stderr, "TRACE: after InitializeSwitchMenu\n");
/* initialize/restore state for the screens */
for (j = 0; j < w_global.screen_count; j++) {
fprintf(stderr, "TRACE: restore loop start j=%d\n", j);
int lastDesktop;
lastDesktop = wm_backend->netwm_get_current_desktop(wScreen[j]);
fprintf(stderr, "TRACE: after netwm_get_current_desktop\n");
wwarning("startup: wScreenRestoreState begin (screen %d)", j);
wScreenRestoreState(wScreen[j]);