|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001680||FSSCP||FRED||public||2008-05-01 04:25||2008-10-28 14:15|
|Target Version||Fixed in Version||3.6.10|
|Summary||0001680: Disbanding wing results in "Assert: (wing < MAX_WINGS) && Wings[wing].wave_count"|
|Description||Attempting to disbanding a wing that is referenced in an event I get the usual yes no cancel window. I am going to delete the event so I said yes. Second window pops up for the same event and again I say yes. Then I receive a window with a $ and 2 squares. Clicking OK (only option) gave me a message something like wave threshold to high setting to -1. That results in an infinite loop of that same error over and over. |
Tried running debug build and instead of the $ and 2 box message I received one with a bunch of exclamation points followed by this:
Assert: (wing < MAX_WINGS) && Wings[wing].wave_count
File: d:\c++\freespace\fs2_open 3.6.9 - btrl\code\fred2\shipeditordlg.cpp
[This filename points to the location of a file on the computer that built this executable]
|Additional Information||TBP build of FRED 3.6.9 dated 3/30/08. To reproduce the error load the attached mission, open the wing editor, select maint bot wing 4 and hit disband.|
|Tags||No tags attached.|
|Does this only occur if you disband the wing with the ships editor open?|
|When I was trying it I did not have the ships editor open just the wing editor. I may have had it opened the first time I crashed but the next time and the time I ran debug I did not. Just opened the mission, went to the wing editor and started disbanding the wings. I can try it with the ship editor open lather and see what happens.|
|Definitely happens in the most recent 4670 revision, regardless of VS2008 or VC6 as a compiler. Crashes the same in both. Gonna bump priority and confirm. Kara, I'm guessing you'll be taking another look at this, but if you think it's not worth fixing in the immediate future then feel free to bump priority back down.|
|Reading my last note, I must have meant 4870 and not 4670. Had to be a typo.|
I'll be damned if I can figure out what the hell is going on here. I managed to chase the error down to somewhere in MessageBox()
Somewhere in afxcomctl32 this function is being called.
AFX_ISOLATIONAWARE_STATICLINK_FUNC(int ,MessageBoxA,(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType),(hWnd,lpText,lpCaption,uType),0)
The data going in doesn't look particularly dodgy so I have no idea what is causing it at all.
What's really strange is that error is coming from sexp_reference_handler() from the first of these two lines
r = Fred_main_wnd->MessageBox(msg, "Warning", MB_YESNOCANCEL | MB_ICONEXCLAMATION);
if (r == IDNO)
Yet if I breakpoint both lines I can still get the code to give the "Disbanding wing results in "Assert: (wing < MAX_WINGS) && Wings[wing].wave_count"" error. Without hitting the second breakpoint! I have no explanation for this. After the weird error message the program is somehow leaving the Messagebox() code and somehow continuing to execute FRED2 code without passing any intervening code.
Anyway I'm attaching a much simpler mission that displays the exact same behaviour.
The attached diff seems to fix it, though it really needs more of a test than what I put it through before it gets committed.
The first problem is that dialog that just gives garbage characters. That is a simple one to deal with. When it gets to one particular function that bypasses errors, the bypass skips the creation of the error message, but still tries to show the popup. Simply putting the popup in the same bypass check makes sure that it will skip both and then avoid giving you a popup with garbage text (or possibly even crashing).
The second problem is Volition, who wrote some crappy code. ;) The delete wing and disband wing buttons actually did the same thing. The double "referenced an event" message is simply because the function that generates it got called twice, once in the disband function and once in the delete function. This issue not only caused the weird error messages, and the Assert() call getting called when it never should have gotten that far, but also made disbanding a wing also delete the ships that were in said wing. The fix for this is to make the disband function actually do the wing cleanup like the delete wing function does. The trick is merely passing a 0 to remove_ship_from_wing() so that it avoids calling the delete wing function once the wing would be empty. Now you get the wing removed, but the ships remain intact (other than being renamed).
No objections. No complaints. So...
|2008-05-01 04:25||FUBAR-BDHR||New Issue|
|2008-05-01 04:25||FUBAR-BDHR||File Added: FUBAR_M02.fs2|
|2008-05-01 04:25||FUBAR-BDHR||File Added: fs2_open.log|
|2008-05-15 16:07||karajorma||Note Added: 0009334|
|2008-05-15 19:55||FUBAR-BDHR||Note Added: 0009337|
|2008-10-09 01:01||chief1983||Note Added: 0009882|
|2008-10-09 01:01||chief1983||Priority||normal => high|
|2008-10-09 01:01||chief1983||Status||new => confirmed|
|2008-10-19 13:29||karajorma||Status||confirmed => assigned|
|2008-10-19 13:29||karajorma||Assigned To||=> karajorma|
|2008-10-20 02:46||chief1983||Note Added: 0010063|
|2008-10-24 18:03||karajorma||Note Added: 0010117|
|2008-10-24 18:04||karajorma||File Added: Disband Me.fs2|
|2008-10-25 06:24||taylor||File Added: 1680.diff|
|2008-10-25 06:33||taylor||Note Added: 0010121|
|2008-10-28 14:15||taylor||Status||assigned => resolved|
|2008-10-28 14:15||taylor||Fixed in Version||=> 3.6.10|
|2008-10-28 14:15||taylor||Resolution||open => fixed|
|2008-10-28 14:15||taylor||Note Added: 0010133|