New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CTD under Release configuration. #11
Comments
Stack trace: 0023:06A20C69 xrGame.dll, CEntity::shedule_Update(), d:\src\xrgame\entity.cpp, 328 [error][ 87] : The parameter is incorrect. |
Pushing workaround for that problem... |
@STALKER2010 : Before the repo revert, I tried your workaround in the game, it worked perfectly. |
@nitrocaster requires us to write only top-quality code. Well, my solution
|
Oooops.. i have to take that back, something is not working perfectly, and i'm not sure what caused this error. The compile with release config went fine, but I'm using a mod, that comes with extra patch files (textures packed into xpatch_03.db, xpatch_04.db etc. files). The game engine doesn't read these db files, and doesnt find any of the packed textures. |
Are you sure, that it is caused by my commit? Try compiling without it. It
|
I try to compile with the latest commit, and i didn't say your commit caused it. ;) |
@STALKER2010, it's not your commit's fault. I have still the same error with the latest commit: Modded game with @STALKER2010's xrGame crash fix: in the main menu, missing textures in the log, the engine doesn't read the extra xpatch_*.db files, i can't start a new game and load a map because of missing textures. Am i the only one with this error? |
You can't start new game because of CTD being discussed here or for some other reason? I've build release by myself and got the same CTD. I've debugged it and found some problems that may cause such crash. Will elaborate on that soon. |
@STALKER2010's fix worked like charm, but i couldn't start a new game, because of engine doesn't read my xpatch_03.db-xpatch_07.db files (which results missing textures ctd on not-vanilla map load). |
Investigating with a couple breakpoints shows that a member variable m_entity_condition in Entity.h somehow is either set to NULL, or is never initialized. The error is essentially a segfault. Checking through the stack trace to see whether this value is set on accident or if there's a potential race condition. |
Alright, I think I found it. There appears to be a logic bug in CEntity::create_entity_condition When m_entity_condition is created inside of the DLL, it looks like it's casted to an entity condition class only when the parameter passed to the function is NULL, which would naturally be A Bad Thing ™ |
If so, why doesn't it occur in Debug configuration? |
I'm not yet sure. I'm looking around at the header files within the stack trace that have
|
Note that debug configuration hides plain dynamic_cast under smart_cast. |
Scratch that, I misread the code :p I'm now not really sure what causes the issue. It looks like either |
Okay, so the issue appears to be something wrong with It's right here. I'm going to take a stab at refactoring the code a tiny bit so as not to use I'll let you all know how the patch fares in Debug compilation as well as when running Dedi. |
Okay, so reformatting the code to a slightly more sane interface hasn't really fixed the problem. Due to the fact that I'd rather not spend several days looking at how the scheduler fetches/creates/initializes objects, I think it might just be sufficient for now to do a NULL check on My gut tells me this is just a race condition, and that if we defer the death check upon starting a new game in the |
@Bangalore1010, have you managed with that problem with .db files? |
@nitrocaster : no, i didn't work with/on this repo. |
@Bangalore1010 There's a special switch -auto_load_arch that may help. Try it. |
Finally the problem is solved, the engine from new bins can read db files, ofc. |
Bangalore, will you be committing yours and Alun's source changes to this project? They would be helpful for all. |
Here is what was causing this issue (and potentially many others): m_textures.insert(mk_pair(id,info)); This line in /* avo: fix issue when values were not updated (silently skipped) when same key is encountered more than once. This is how std::map is designed. Also used more efficient C++11 std::map::emplace method instead of outdated std::pair::make_pair */
/* XXX: avo: note that map.insert(mk_pair(v1,v2)) pattern is used extensively throughout solution so there is a good potential for other bug fixes/improvements */
if (m_textures.find(id) == m_textures.end())
m_textures.emplace(id, info);
else
m_textures[id] = info;
//m_textures.insert(mk_pair(id,info)); // original GSC insert call
/* avo: end */ |
To @avoitishin : That's unrelated to the problem that we discussed here, though it have to be fixed. |
This was in response to Bangalore's post about ui_mainmenuX.xml not picking up texture information. Already fixed in working brach of my fork and I agree with you that it should be separated into it's own issue |
CTD occurs when compiling under Release configuration.
Ideally this shouldn't happen, as we would like to have a debug free binary for releases :)
This occurs during the scheduler's update function call (stack trace in comments).
The text was updated successfully, but these errors were encountered: