chrisboyle / sgtpuzzles

Android port of Simon Tatham's Puzzles
https://chris.boyle.name/puzzles
Other
586 stars 167 forks source link

Weird behavior when aborting new game generation #548

Closed fropeter closed 2 years ago

fropeter commented 2 years ago

This is a weird problem which I can't recall encountering before the latest update of the app. Version: 2022-04-30-1100-c43a34fb

(In the description A refers to the aborted game, B refers to the game played instead.)

Sometimes a new game takes a long time to generate, and I abort it (A). Pearl is the game that most often need a long time to generate, but other games might occationally have the same problem.

When I abort generating a new game, it seems as if the process keeps running. If I start a different game instead (B), it functions as normal, until it suddenly doesn't receive any input in the game area anymore. Exiting to the app's home screen and choosing the same game type (B), the game area is replaced by the aborted game (A), and any screen interactions made in game B while it was unresponsive, is shown on the game area for game A (depending on game type).

Exiting the puzzle, either to the puzzle list or completely, does not fix game B. I have to start a new game from the game menu (B) to get the correct game area back, but my custom settings are reset to the default values.

I have tried this with a few puzzle types, and the behaviour seems to not be related to specific games, but to aborting a game being generated. I have also tried rebooting the phone, with no effect on the problem.

Device: Sony Xperia 5ii, Android 12.

To Reproduce Steps to reproduce the behavior:

  1. Start a new puzzle that takes a while to generate
  2. Abort the puzzle before generation is complete
  3. Start a different puzzle, and interact with it (a.k.a. play)
  4. When the game becomes unresponsive, go back to the puzzle list and select the same puzzle
  5. The game heading is that of the game I played, while the game area is of the aborted type, possible with interactions shown (Example: If Pearl was aborted, and Bridges was played instead, then screen interactions not shown in Bridges, are visible in Pearl. Clarification: visible in Pearl game area in Bridges game, not if Pearl is selected from the game list.)
  6. From the puzzle heading, open the menu and select "New game"
  7. The game area is now of the correct type, but the custom settings are lost (size etc.)

Expected behavior

  1. Aborting a puzzle being generated should stop the process
  2. Even if the process is completed in the background, it should not interfere with any other game type, but be ready for the next time that game type is selected
  3. The custom settings should not be reset as a result of this problem

Screenshots 3 screenshots are attached, showing mismatch between game header and game area. (One of the Pearl screenshots shows lines resulting from playing Bridges after it becoming unresponsive.

Version info (optional, but sometimes helpful)

Additional context

Screenshot_20220513-211611~2 Screenshot_20220513-214259~2 Screenshot_20220513-215822~2

chrisboyle commented 2 years ago

Thank you very much for the detailed bug report. I'll push a beta build soon with this fix.

abdulisik commented 2 years ago

I've also realized a similar behavior on Solo, which would take a good amount of time to generate using extreme custom values. Though, I want to have an option to let Puzzles generate a new game in the background while I'm spending time in the current one, so that I can finally enjoy that 16×16 Jigsaw Solo. (Thank you for your commitment in this app, Chris)