News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

[GUI bug] Crash in network diagram

Started by jamespetts, January 08, 2023, 09:37:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

I have had reports of a crash when using the "network diagram" tab of the vehicle information window. I have been able to create a reliable reproduction case for this, but I have not been able to fix this as it is a cryptic issue that occurs in GUI code about which I know virtually nothing.

The reproduction case is from demo.sve: open convoy 113 (GWR Gloucester Railcar departing Christminster Central) and select the network diagram tab. The crash reliably occurs on deselecting "show only own network".

In the Visual Studio debugger, I get a crash at line 227 of gui_container.cc. I have address sanitiser turned on: the error that I get is from the address sanitiser, telling me that deallocated memory has been used. That line is very simple:

list_dirty = false;

list_dirty is a heap allocated variable and is a member of gui_container_t. It is not at all clear where the memory for this was deallocated - presumably, some code somewhere deletes gui_container.cc inappropriately, but I have no way of tracking down where this occurs.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ranran

Quote from: jamespetts on January 08, 2023, 09:37:11 PMlist_dirty is a heap allocated variable and is a member of gui_container_t. It is not at all clear where the memory for this was deallocated - presumably, some code somewhere deletes gui_container.cc inappropriately, but I have no way of tracking down where this occurs.
For some reason I can't reproduce that crash. However, I had a similar issue before. I'm guessing that it is probably caused by the pressed button removing itself. I will deal with that.

jamespetts

Quote from: (N)Ranran (Hibernating) on January 09, 2023, 12:01:46 AMFor some reason I can't reproduce that crash. However, I had a similar issue before. I'm guessing that it is probably caused by the pressed button removing itself. I will deal with that.
I think that you may need to turn on the address sanitiser in Visual Studio to reproduce this reliably; but I shall be interested to re-test when you have addressed this. Thank you.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ranran

Quote from: jamespetts on January 09, 2023, 12:19:41 AMbut I shall be interested to re-test when you have addressed this
I have implemented a workaround for this issue. I would appreciate it if you could confirm that this is working fine. You can see it in pull request #598.
The layout has changed slightly.

jamespetts

Quote from: (N)Ranran (Hibernating) on January 09, 2023, 06:49:51 AMI have implemented a workaround for this issue. I would appreciate it if you could confirm that this is working fine. You can see it in pull request #598.
The layout has changed slightly.
Excellent, thank you. This seems to have fixed it. Now incorporated.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.