Project

General

Profile

Actions

Bug #1827

closed

Segmentation fault from mouse click in gotodlg.cpp

Added by John Robertson 12 days ago. Updated 6 days ago.

Status:
Closed
Priority:
Normal
Category:
Qt-client
Target version:
Start date:
12/20/2025
Due date:
% Done:

0%

Estimated time:

Description

my mouse clicks are messy, so I'm not sure whether a city was selected or not.

Looking at the coredump, it is clear that `game_city_by_number(city_id)` returns nullptr.

The `city_id` seemed to be out of range.

coredump in debugger


Files

clipboard-202512200001-yvmpo.png (261 KB) clipboard-202512200001-yvmpo.png coredump in debugger John Robertson, 12/20/2025 09:01 AM
1827.patch (824 Bytes) 1827.patch John Robertson, 12/20/2025 09:14 AM
1827.v2.patch (1.06 KB) 1827.v2.patch John Robertson, 12/20/2025 09:06 PM
Actions #1

Updated by John Robertson 12 days ago

Actions #2

Updated by Marko Lindqvist 12 days ago

John Robertson wrote:

Looking at the coredump, it is clear that `game_city_by_number(city_id)` returns nullptr.

The `city_id` seemed to be out of range.

Even if that was not what happened to you, I think it's quite possible that a city gets destroyed while the dialog is open, leading to such a segfault.

Actions #3

Updated by Marko Lindqvist 12 days ago

  • Status changed from New to In Review
  • Assignee set to Marko Lindqvist
  • Target version set to 3.2.2
Actions #4

Updated by John Robertson 12 days ago

Marko Lindqvist wrote in #note-2:

John Robertson wrote:

Looking at the coredump, it is clear that `game_city_by_number(city_id)` returns nullptr.

The `city_id` seemed to be out of range.

Even if that was not what happened to you, I think it's quite possible that a city gets destroyed while the dialog is open, leading to such a segfault.

Yes, I have seen a conquered enemy city stay in the gotodlg list, not updated. E.g. the city doesn't switch sides, or a deleted city remains in the list until the next refresh.

Actions #5

Updated by John Robertson 12 days ago

Maybe the return should include a list refreash.

Actions #6

Updated by John Robertson 12 days ago

Actions #7

Updated by Marko Lindqvist 11 days ago

At least for the 3.2.2 release coming out soon (-> with limited testing time left) I still plan to go with the original minimal-risk patch. We can revisit this in the full 3.2.3 cycle.

Actions #8

Updated by Marko Lindqvist 6 days ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF