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

Crash when loading scenario (after previously quitting scenario) #683

Closed
HansLemurson opened this issue Oct 11, 2021 · 7 comments · Fixed by #688
Closed

Crash when loading scenario (after previously quitting scenario) #683

HansLemurson opened this issue Oct 11, 2021 · 7 comments · Fixed by #688
Assignees
Labels
bug Something isn't working

Comments

@HansLemurson
Copy link

HansLemurson commented Oct 11, 2021

Describe the bug
If you load a scenario, then disconnect or otherwise leave the game, when you try to load a scenario again, the program crashes.

To Reproduce
Steps to reproduce the behavior:

  1. Click "Start Scenario Game" (this takes a while)
  2. Click "Disconnect" after it loads up
  3. In the main menu, click "Start Scenario Game" again.
  4. Program should now crash after the "starting local server" message appears.

Expected behavior
The menu of scenarios should show up a second time, this being the function of the "Start Scenario" button.

Screenshots
How do you show a picture of something crashing?
image

Platform and version (please complete the following information):

  • OS: Windows 10
  • Freeciv21 version: 3.0.20210912.6
  • Ruleset/Longturn game (if applicable): N/A

Additional context
"Start Scenario Game" seems to take a fairly long time to load up the menu showing all the scenarios. Could this perhaps be related?

@HansLemurson HansLemurson added bug Something isn't working Untriaged This issue or PR needs triaging labels Oct 11, 2021
@lmoureaux lmoureaux removed the Untriaged This issue or PR needs triaging label Oct 13, 2021
@lmoureaux lmoureaux self-assigned this Oct 13, 2021
@lmoureaux
Copy link
Contributor

I can at least reproduce the long loading time. Fixing that first..;

@HansLemurson
Copy link
Author

I can confirm the crash happens with Alpha 8 as well.

I noticed that on one occasion, after leaving a game, when I clicked on the Scenario list the game-server of the old game (the one I'd just left) appeared momentarily before the crash.

Perhaps it is some sort of error involved with making a new server when the previous one is still running?

@lmoureaux
Copy link
Contributor

I have a fix for the crash, now looking at the performance issue. Do you have many saves in the same folder as the server, or in the data folder?

@HansLemurson
Copy link
Author

10 savegames + 50 autosaves. All of the saves are stored in C:\Users\username\AppData\Roaming\Freeciv21\saves. I haven't touched the data folder in the fc21 install directory.

@HansLemurson
Copy link
Author

More testing showed that the crash only happens if I have clicked on a particular scenario prior to canceling and re-opening the Scenario menu.

@lmoureaux
Copy link
Contributor

More testing showed that the crash only happens if I have clicked on a particular scenario prior to canceling and re-opening the Scenario menu.

This is right; the problem is that when it reloads the list of scenarios, it starts by erasing the list, which also erases the selection. But the code called when the selection is updated assumes that at least one item is selected.

lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Oct 15, 2021
The client was crashing when loading a scenario, exiting the game, and trying
to go back to the scenario page. The reason was that the list of scenarios is
reloaded in this case, and the first time the loading code does is to clear the
QListWidget holding the list of scenarios. This propagated to the "selection
changed" callback that was trying to access the (nonexistant) first selected
item, resulting in a crash.

The fix is to check that there's something selected before trying to use it.

See longturn#683.
@lmoureaux
Copy link
Contributor

The delay when loading the list is most likely related to the server starting in the background.

lmoureaux added a commit that referenced this issue Oct 27, 2021
The client was crashing when loading a scenario, exiting the game, and trying
to go back to the scenario page. The reason was that the list of scenarios is
reloaded in this case, and the first time the loading code does is to clear the
QListWidget holding the list of scenarios. This propagated to the "selection
changed" callback that was trying to access the (nonexistant) first selected
item, resulting in a crash.

The fix is to check that there's something selected before trying to use it.

See #683.
psampathkumar pushed a commit to psampathkumar/freeciv21 that referenced this issue Nov 14, 2021
The client was crashing when loading a scenario, exiting the game, and trying
to go back to the scenario page. The reason was that the list of scenarios is
reloaded in this case, and the first time the loading code does is to clear the
QListWidget holding the list of scenarios. This propagated to the "selection
changed" callback that was trying to access the (nonexistant) first selected
item, resulting in a crash.

The fix is to check that there's something selected before trying to use it.

See longturn#683.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants