Hello, Eric and everybody!
wineconsole crashes in WCCURSES_Refresh() when run without arguments. PRIVATE(data)->line is NULL in curses.c on line 354. Checking PRIVATE(data)->line fixes the problem.
The breakage was introduced by revision 1.39 of wineconsole.c. Removing call to WINECON_GetServerConfig() fixes the crash.
Although WINECON_GetServerConfig() gets data that is mostly irrelevant to the curses backend, the harmful part is setting data->cells. Commenting it out also helps (but the "user" backend stops working).
I think setting data->cells doesn't belong to WINECON_GetServerConfig(). Since setting data->cell suppresses handling of CONSOLE_RENDERER_SB_RESIZE_EVENT, data->fnResizeScreenBuffer and data->fnComputePositions should be called explicitly.
Below is the patch I think is most reasonable. Still, I'd like someone more knowledgeable to look at it.
I moved the code under init_success outside the switch statement, as it was getting too long.
--- wineconsole.c +++ wineconsole.c @@ -557,9 +557,6 @@ static BOOL WINECON_GetServerConfig(stru } SERVER_END_REQ; WINECON_DumpConfig("first cfg: ", &data->curcfg); - data->cells = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - data->curcfg.sb_width * data->curcfg.sb_height * sizeof(CHAR_INFO)); - if (!data->cells) WINECON_Fatal("OOM\n");
return ret; } @@ -654,13 +651,9 @@ static struct inner_data* WINECON_Init(H switch ((*backend)(data)) { case init_success: - WINECON_GetServerConfig(data); - WINECON_SetConfig(data, &cfg); - data->curcfg.registry = cfg.registry; - WINECON_DumpConfig("fint", &data->curcfg); - return data; - case init_failed: break; + case init_failed: + goto error; case init_not_supported: if (backend == WCCURSES_InitBackend) { @@ -673,6 +666,17 @@ static struct inner_data* WINECON_Init(H break; }
+ WINECON_GetServerConfig(data); + data->cells = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + data->curcfg.sb_width * data->curcfg.sb_height * sizeof(CHAR_INFO)); + if (!data->cells) WINECON_Fatal("OOM\n"); + data->fnResizeScreenBuffer(data); + data->fnComputePositions(data); + WINECON_SetConfig(data, &cfg); + data->curcfg.registry = cfg.registry; + WINECON_DumpConfig("fint", &data->curcfg); + return data; + error: WINE_ERR("failed to init.\n");