Ticket #137 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Menu crashes if user selects Editor -> (edits something) then hits escape twice

Reported by: chris Owned by:
Priority: major Milestone: 0.5.0
Component: Source Version:
Keywords: Cc:

Description

See summary. Current as of git master, 2011-05-01.

Attachments

valgrind.log (27.5 KB) - added by chris 2 years ago.
Valgrind output log. Invalid read of size 1 in UI::Draw is the bug.

Change History

comment:1 Changed 2 years ago by chris

Actually crashes just on escape from editor (when switching back to menu). Also only occurs if you click the 'default' scenario button then hit edit. Just hitting edit does not cause crash.

comment:2 Changed 2 years ago by knowknowledge

I believe that this is fixed in the current master branch.

While adding the Actions, I noticed an interesting potential bug:

While executing code in activated by a button, the code can close (and therefore delete) the button that is currently executing that code. This means that any code executed after an Action is Activated() that attempts to access the object can trigger a segfault.

There are two solutions to this problem that I can think of:
1: All code that could potentially activate an action must be at the end of the function.
2: No Widgets should get deleted immediately, but should persist until all Widget actions have completed.

Solution (1) is a bit difficult because there are some Widget functions that have multiple exit points.
Solution (2) requires some extra tracking, but is definitely possible.

Changed 2 years ago by chris

Valgrind output log. Invalid read of size 1 in UI::Draw is the bug.

comment:3 Changed 2 years ago by chris

Added an 'if' statement to my git repo at knowknowledge's advice to avoid the bug. Added a FIXME as something is still clearly wrong.

comment:4 Changed 2 years ago by knowknowledge

  • Status changed from new to closed
  • Resolution set to fixed

The Screen Swap was not flushing the deferred list, so floating widgets were neither drawn nor forgotten. Each time that one of the screens with an open Dropdown, the drawing of the Dropdown would be deferred, but not flushed. This meant that there were several stale Dropdown pointers in the deferred list caused by Swapping screens. If the UI is Closed before it is drawn, then those stale pointers will be accessed incorrectly.

Fixed in: 0f1dc8d26ef3d2e522f4dfae7e0f6c1682d2f060

Note: See TracTickets for help on using tickets.