UFO: Alien Invasion Issue Tracker
UFO: Alien Invasion
Go to the previous open issue
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
icon_project.png UFO: Alien Invasion / Closed Submit Patch #4559 mission retry -> equip segfault
Go to the next issue (open or closed)
Go to the next open issue
This issue has been closed with status "Closed" and resolution "Not determined".
Issue basics
  • Type of issue
    Submit Patch
  • Category
    General
  • Targetted for
    Not determined
  • Status
    Closed
  • Priority
    3. Normal
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (0)
There are no items
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
Attachments (0)
There is nothing attached to this issue
Duplicate issues (0)
This issue does not have any duplicates
Description
[http://sourceforge.net/p/ufoai/patches/432 Item 432] imported from sourceforge.net tracker on 2013-01-28 20:39:33

Sometimes when the player retries a mission, wins, and then tries to access the equip screen after the aircraft returns to base, the game coredumps. I managed to trace the problem to the static global variable invUnused that marks the next unused inventory position in the invList array. When the server is running a mission, the inventory is re-initialized with invChain, a server static array, causing invUnused to point there, saving its old address to invUnusedRevert. When the player retries a mission, that is repeated, so now we have addresses from invChain in both invUnused and invUnusedRevert. Then the mission ends, the server quits (and its memory is reclaimed by unloading the library), so the reverted invUnused pointer points to freed memory. Then that goes into one of the ->next pointers when rebuilding the base inventory after the aircraft returns, which will give a segfault at the next access. My solution is to move the call to INVSH_InvUnusedRevert to the server shutdown, so that it is restored (and re-initialized) at every retry. It seems to miss the segfault now, but more testing is necessary to verify.
===== Comments Ported from Sourceforge =====

====== polyvios (2009-08-28 01:00:07) ======


====== tlh2000 (2009-08-28 13:22:43) ======

Applied to trunk - thanks
====== tlh2000 (2009-08-28 13:22:47) ======

thanks for the fix - it's applied to trunk now and you explainantion is perfect ;)
Todos (0 / 0)
Issue created
footer_logo.png The Bug Genie 4.3.1 | Support | Feedback spinning_16.gif