bugBos Wars - Bugs: bug #28907, null pointer dereference in patch...

 
 

bug #28907: null pointer dereference in patch editor after closing menu

Submitted by:  Kalle Olavi Niemitalo <kon>
Submitted on:  Mon 15 Feb 2010 10:26:02 PM UTC  
 
Severity: 5 - BlockerItem Group: Bug
Status: FixedPrivacy: Public
Assigned to: François Beerten <feb>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 28 Feb 2010 01:19:19 PM UTC, comment #2:

The function keys are now disabled. Thanks for the report.

François Beerten <feb>
Project AdministratorIn charge of this item.
Mon 15 Feb 2010 11:10:47 PM UTC, comment #1:

Forget about saving/restoring the callbacks in MenuScreen. It won't work because scripts/menus/patch.lua starts the patch editor while the menu is still up. The situation can change behind the menu and the saved callbacks would then be wrong.

jim5 pointed out that the patch editor should not allow these menus to be opened in the first place. For example, F11 opens the Save Game menu, and if you actually try to save the game in the patch editor, it'll just crash in SavePlayers because that tries to read ThisPlayer->Index and ThisPlayer is null if no game has been played.

Kalle Olavi Niemitalo <kon>
Project Member
Mon 15 Feb 2010 10:26:02 PM UTC, original submission:

Start Bos Wars. Click Start Editor. Click Patch Editor. Click Load Patch. Select some patch (e.g. the default Grass-plain) and click Load Patch. Press F10 to open Game Menu. Press Esc to Return to Game (hah!). Press Esc again to crash the editor.

This bug happens only in the trunk (tested r9633). It does not happen in boswars-2.5 because there's no patch editor there.

InputKeyButtonPress is trying to call callbacks->KeyPressed(ikey, ikeychar) but all the function pointers in *callbacks are null. This happens because MenuScreen::stop doesn't realize the patch editor is active and calls SetCallbacks(&GameCallbacks) but GameCallbacks has not been populated.

One way to fix this would be to make MenuScreen::run save the original callbacks so that MenuScreen::stop wouldn't have to guess which ones they were.

Kalle Olavi Niemitalo <kon>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #19712:  gdb.log added by kon (12KiB - text/x-log)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by feb (Updated the item)
  • -unavailable- added by kon (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 28 Feb 2010 01:19:19 PM UTCfebStatusNone=>Fixed
      Assigned toNone=>feb
      Open/ClosedOpen=>Closed
    Sat 20 Feb 2010 08:28:00 PM UTCfebSeverity3 - Normal=>5 - Blocker
    Mon 15 Feb 2010 10:26:02 PM UTCkonAttached File-=>Added gdb.log, #19712

    Back to the top


    Powered by Savane 3.1-cleanup1