Skip to content
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

Msvc 2013 changes #2621

Merged

Conversation

fluffyfreak
Copy link
Contributor

Some things pointed out by the MSVC code analysis I was playing around with.
Mostly just trying to make sensible changes too a few things, remove redundant overloads and get rid of some rubbish code etc.

…obs, they were legacy and just for development, probably unsafe for use in production anyway.

Add a safety check for receiving a patch job result.
…elease builds where the assert is omitted we still get sane default values out.
Add profiling to StarSystem, not sure why it wasn't done before since it's so expensive.
std::map<SystemPath,StarSystem*>::iterator i = s_cachedSystems.begin();
while (i != s_cachedSystems.end()) {
StarSystem *s = (*i).second;
assert(s->GetRefCount() >= 1); // sanity check
// if the cache is the only owner, then delete it
if (s->GetRefCount() == 1) {
if (s && s->GetRefCount() == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's any situation where a null item in s_cachedSystems is valid, right? In which case this should be assert(s) before the if statement, not just skipping null items. (Or just leave it as it was, since if null is s then s->GetRefCount() should crash quickly).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one was just a paranoia check so it can just be removed.

@johnbartholomew
Copy link
Contributor

Given that the BasePatchJob::s_abort stuff has been removed, I guess we can also remove the disabled job cancel sections in GeoSphere::~GeoSphere and GeoSphere::OnChangeDetailLevel.

@robn
Copy link
Member

robn commented Jan 7, 2014

Err, why is that stuff removed? It used to be necessary to quickly abort the terrain thread after config change and on hyperspace. Does that not work any more?

Seems like a big change for a "compiler tweaks" PR...

(on my phone right now)

@fluffyfreak
Copy link
Contributor Author

@johnbartholomew it is removed, in the same commit :)

@robn don't panic, that stuff became redundant a long while ago and has been sat disabled in the code for... I don't know how long but 6 months? Maybe longer? Not needed or used anymore anyway.

@robn
Copy link
Member

robn commented Jan 7, 2014

Cool then!

Sorry, not a panic, I honestly wasn't sure and wasn't able to check right this second. Thanks :)

@johnbartholomew
Copy link
Contributor

@fluffyfreak Oh, so it is! I was looking up where s_abort was used in master and then forgot to look at the rest of the diff for this PR before commenting.

@johnbartholomew
Copy link
Contributor

Merging now. I'm changing most of the pointer checks you added to be asserts, because silently ignoring invalid state just helps to hide bugs. I'm leaving the one in PicoDDS, because I think a 0 result from that function is a reasonable response to failure there (not that the return value is checked but what the heck).

@johnbartholomew johnbartholomew merged commit 2a1820f into pioneerspacesim:master Jan 7, 2014
@fluffyfreak fluffyfreak deleted the msvc_2013_changes branch January 7, 2014 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants