Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main-sdl2.c "graphics.texture != NULL" crash, or black screen, changing tile settings on menu screens #5552

Closed
smbhax opened this issue Nov 9, 2022 · 6 comments · Fixed by #5555
Milestone

Comments

@smbhax
Copy link

smbhax commented Nov 9, 2022

Tested in MSYS2-compiled SDL2 front-end, latest code, somewhat dirty, under Windows 11.

Turning tiles off while on a menu screen in the SDL2 front end compiled under MSYS2 frequently crashes the game. If no crash occurs, the text goes blank, leaving a plain black main window with only the yellow cursor showing. Toggling tiles on in the menus, or changing their size, similarly blanks the text, but does not produce a crash.

Two that have produced the crash consistently:

  1. With Gervais tiles on, press C to open the character screen, or = to open the main menu screen
  2. Select Menu > Angband > Tiles > Set > None from the top-left drop-down menu
    == The game crashes with a Windows error window (see screenshot below)

Microsoft Visual C++ Runtime Library

Assertion failed!

Program: C:\msys64\home\smbhax\angband\angband.exe
File: main-sdl2.c
Line: 3881

Expression: subwindow->window->graphics.texture != NULL

crash

The behavior when toggling tiles off on other menu screens sometimes been inconsistent. For a while, about half were just blanking the screen, rather than crashing. The "?" help screen usually produced a crash, but once I just got a blank screen, then when I backed out, the void around the town was filled with a loose grid of tiles (didn't screenshot that and now I can't reproduce it--just crashes--drat). Currently, all menus, even a partial menu like the "e" equipment screen, are leading to the crash when toggling the tiles off.

Example of blanking the screen:

  1. With Gervais tiles on, press ~ to open the Knowledge screen
  2. Select Menu > Angband > Tiles > Size > Tile width 1 (click the right side to raise it to 2) from the top-left drop-down menu

or

  1. With Gervais tiles off, press ~ to open the Knowledge screen
  2. Select Menu > Angband > Tiles > Set > Gervais

== The main window text goes black.

blank

@smbhax
Copy link
Author

smbhax commented Nov 9, 2022

In the Windows front-end, the graphics menu is locked while in a menu, so it is not possible to follow the steps there to reproduce the issue. (Curiously, only the 16x16 tile size multiplier menu option is left not-grayed-out, and selecting it pops up a message saying you aren't allowed to do that right now.)

@backwardsEric
Copy link
Contributor

I was able to reproduce the crash on Linux with the SDL2 front end if I had a subwindow open displaying the player (compact) data and that subwindow was displaying tiles for the equipment slots. Did you have that subwindow open for the crashes you saw (it looks like you do from the screenshots)? With that subwindow closed, do you see any crashes when you turn off tiles, either with or without a menu open in the main window?

From what I'm seeing, this is related to #5551 . Because the player (compact) window isn't properly updated for changes to the tile set used, it can still have locations that say "use tile x". With the change to no tiles, the SDL2 client no longer has the tiles loaded into a texture so drawing that location triggers the assertion failure.

@smbhax
Copy link
Author

smbhax commented Nov 9, 2022

I had had that thought as well but yes, I still get the crash (only with a menu screen open) even with the player compact subwindow off. The behavior may change slightly though: with the player compact subwindow and the monster list off, I usually had to click in the blanked main window, then hit ESC, before the crash would occur after turning tiles off; it didn't occur immediately as it usually had when I'd had all subwindows visible (whether or not the tiles were visible in them at the time).

backwardsEric added a commit to backwardsEric/angband that referenced this issue Nov 9, 2022
…when using tiles and the tile multipliers are different than 1 x 1. Avoids displaying truncated tiles in that situation. Found while researching angband#5552 .
backwardsEric added a commit to backwardsEric/angband that referenced this issue Nov 9, 2022
…entry act like the other multiplier entries (pointed out in angband#5552 ) ; disable all the tile multiplier entries when not using tiles
backwardsEric added a commit to backwardsEric/angband that referenced this issue Nov 10, 2022
…(for SDL and SDL2 also disable those changes until the character is fully in game; Mac does allow changes while on the splash screen); resolves angband#5552
@backwardsEric
Copy link
Contributor

#5555 fixes this by having the SDL2 front end act like the Windows front end: only allow changing the tile set used when at a command prompt in game. There isn't the infrastructure internally to make dismissing an in-game menu robust to changes of the tile set used while the menu was open.

@backwardsEric
Copy link
Contributor

The blank screens in response to changing the tile multipliers aren't affected by #5555 . Could try to get the menus to redraw themselves in those situations or, like the handling of changing the tile set, disable the ability to change the multipliers when not at a command prompt (the latter is likely cleaner; because redrawing the menu itself doesn't help with the display artifacts that can be there when the last menu is dismissed and return to the command prompt).

@smbhax
Copy link
Author

smbhax commented Nov 10, 2022

Yeah, if you're locking the one, you might as well lock the other as well. It'll be consistent with the Windows front end, too.

backwardsEric added a commit to backwardsEric/angband that referenced this issue Nov 11, 2022
…ame menu (for SDL and SDL2 also disable those changes until the character is fully in game; Mac does allow changes while on the splash screen); resolves angband#5552 ; for Mac, change the interface that sets the multipliers:  no separate dialog and use a menu which sets the desired size (relative to the native size) for the tiles; the recompiled Mac interface file was generated with Xcode 14.1
NickMcConnell pushed a commit that referenced this issue Dec 4, 2022
…when using tiles and the tile multipliers are different than 1 x 1. Avoids displaying truncated tiles in that situation. Found while researching #5552 .
NickMcConnell pushed a commit that referenced this issue Dec 4, 2022
…entry act like the other multiplier entries (pointed out in #5552 ) ; disable all the tile multiplier entries when not using tiles
NickMcConnell pushed a commit that referenced this issue Dec 4, 2022
…#5555)

* SDL, SDL2, Mac:  disable changing the tile set when in a in-game menu (for SDL and SDL2 also disable those changes until the character is fully in game; Mac does allow changes while on the splash screen); resolves #5552

* SDL, SDL2, Mac:  disable changing the tile multipliers when in an in-game menu (for SDL and SDL2 also disable those changes until the character is fully in game; Mac does allow changes while on the splash screen); resolves #5552 ; for Mac, change the interface that sets the multipliers:  no separate dialog and use a menu which sets the desired size (relative to the native size) for the tiles; the recompiled Mac interface file was generated with Xcode 14.1
NickMcConnell pushed a commit to NickMcConnell/FAangband that referenced this issue Dec 4, 2022
…when using tiles and the tile multipliers are different than 1 x 1. Avoids displaying truncated tiles in that situation. Found while researching angband/angband#5552 .
NickMcConnell pushed a commit to NickMcConnell/FAangband that referenced this issue Dec 4, 2022
…entry act like the other multiplier entries (pointed out in angband/angband#5552 ) ; disable all the tile multiplier entries when not using tiles
@backwardsEric backwardsEric added this to the 4.2 milestone Dec 4, 2022
NickMcConnell pushed a commit to NickMcConnell/FAangband that referenced this issue Dec 2, 2023
… (#5555)

* SDL, SDL2, Mac:  disable changing the tile set when in a in-game menu (for SDL and SDL2 also disable those changes until the character is fully in game; Mac does allow changes while on the splash screen); resolves angband/angband#5552

* SDL, SDL2, Mac:  disable changing the tile multipliers when in an in-game menu (for SDL and SDL2 also disable those changes until the character is fully in game; Mac does allow changes while on the splash screen); resolves angband/angband#5552 ; for Mac, change the interface that sets the multipliers:  no separate dialog and use a menu which sets the desired size (relative to the native size) for the tiles; the recompiled Mac interface file was generated with Xcode 14.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants