[BTS] CTD I have never seen before, please help!

Ferocca

Warlord
Joined
Nov 21, 2011
Messages
179
Apparently the mod I am using (RevDCM) does not alter this part of the SDK.
I don't know much about C++ though, but at least enough to use the debug mode in visual studio.
At the point of the crash it says this code crashes the game (the crash always happens when I end the turn):

bool CvDLLEntity::IsSelected() const;
{
return gDLL -> getEntityIFace()->IsSelected(getEntity());
}

I really hope someone has an idea how to fix this bug or at least where it could possibly come from!
The information from the debugger just puzzles me.
 
That's beyond weird. It's a vanilla function and it looks completely unmodified. Try posting the call stack. Maybe that one can provide a clue to what is going on.


Your post is doing a fine job at puzzling me too.

Haha happy to read I am not the only one, thanks for looking into this.Call stack:
1fSrjwB.png
 
That stack only tells that it crashes in the exe, which isn't surprising considering which line we are talking about. However the interesting part is what is calling IsSelected() and if that part could give a clue. However the call stack for the DLL isn't included in the screenshot and it looks like it the next line might even be blank. Are you sure you have compiled a debug DLL?
 
That stack only tells that it crashes in the exe, which isn't surprising considering which line we are talking about. However the interesting part is what is calling IsSelected() and if that part could give a clue. However the call stack for the DLL isn't included in the screenshot and it looks like it the next line might even be blank. Are you sure you have compiled a debug DLL?

Yes the next line is blank! That's all that shows in the call stack.
So just to make sure: I compiled a Release and a Debug DLL, I copied the Debug DLL and replaced that with the 'normal' DLL. I then started the game and had visual studio attach to the BtS process.
After ending the turn where the crash happens, it'd crash to desktop normally, but during this debug process it gave the information provided in the screenshot.
Does the information right below tell anything useful? As I said I don't know much about C++ at all but it seems to say that m_pEntity needs to be defined?
I also wonder how 'IsSelected' can crash the game when rolling over to the next turn...
 
In the bottom left corner, it seems that the this pointer isn't valid (or maybe VC++ is messing that up). Maybe the CvDLLEntity is destructed somewhere? This could be due to erroneously destructing a CvUnit or similar. It's even harder to say without knowing what you changed, though.

I am not sure what you mean as I don't know C++/Civ4's C++ well, but what is changed from the base game, is the RevDCM mod that was made on these forums. What do you mean with CvDLLEntity destructing? And can a CvUnit destruct at the end of the turn? The crash is always after some loading after pressing end turn.
 
Bump, if that's allowed?
Sure it's allowed to announce that the problem is still unsolved. However we are all still clueless to what could cause this issue.

Do you have your mod in git or svn? I think the best (only?) way now would be to go back in history to locate the time when this started to become a problem. Also can you make the game trigger some assert failure prior to the crash if you use the debug dll?
 
@Ferocca: I've done a little experiment to reproduce the problem based on what Ifgr wrote; screenshot attached. Same debugger output as yours I think (never mind the noncopyable thing). So, I guess the debugger doesn't necessarily show a proper call stack when a dangling pointer is accessed, i.e. the IsSelected call that crashes the mod could come directly from the DLL. In that case, one could narrow the problem down by consulting the MPLog (MessageLog=1, RandLog=1 in My Games\Beyond the Sword\CivilizationIV.ini) and then maybe narrow it down more by setting a breakpoint at the last getSorenRandNum call mentioned in the log and going step by step in the debugger from there. The BBAI log could also help (#define LOG_AI in BetterBTSAI.h, LoggingEnabled=1 in CivilizationIV.ini).
 

Attachments

  • access_violation.jpg
    access_violation.jpg
    222.5 KB · Views: 118
Back
Top Bottom