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

fix: do not DCHECK production-necessary methods #20833

Merged
merged 1 commit into from Oct 29, 2019

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Oct 29, 2019

Description of Change

InitializeContext was not being properly called in release builds due to the nature of DCHECKS.

cc @MarshallOfSound @ckerr

Checklist

Release Notes

Notes: Fixed an issue with Node.js context initialization in renderer processes.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Oct 29, 2019
@codebytere codebytere added the fast-track 🚅 Indicates that this PR is intended to bypass the 24 hour rule. Needs approval from Releases label Oct 29, 2019
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Oct 29, 2019
@codebytere codebytere merged commit 5d00494 into master Oct 29, 2019
@release-clerk
Copy link

release-clerk bot commented Oct 29, 2019

Release Notes Persisted

Fixed an issue with Node.js context initialization in renderer processes.

@codebytere codebytere deleted the fix-context-initialize branch October 29, 2019 20:35
@trop
Copy link
Contributor

trop bot commented Oct 29, 2019

I have automatically backported this PR to "8-x-y", please check out #20836

@deepak1556
Copy link
Member

Thanks for fixing this!

But the title and commit message are misleading, DCHECK in non debug builds noops std::ostream with operator<< which doesn't evaluate the conditions. How would having const methods change this ?

std::ostream* g_swallow_stream;

class LogMessageVoidify {
 public:
  LogMessageVoidify() = default;
  // This has to be an operator with a precedence lower than << but
  // higher than ?:
  void operator&(std::ostream& g) {  }
};

#define EAT_STREAM_PARAMETERS \
  true ? (void)0              \
       : LogMessageVoidify() & (*g_swallow_stream)
       
#define DCHECK(condition) EAT_STREAM_PARAMETERS << !(condition)

@codebytere
Copy link
Member Author

codebytere commented Oct 29, 2019

oh yes sorry there's some missing context - we want to make it in a future PR so that we lint against non-const methods (methods that could have side effects on input params) being used in DCHECKs. we know it doesn't work now :)

@codebytere codebytere changed the title fix: do not DCHECK non-const methods fix: do not DCHECK production-necessary methods Oct 29, 2019
@sofianguy sofianguy added this to Fixed in 8.0.0-beta.2 in 8.2.x Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fast-track 🚅 Indicates that this PR is intended to bypass the 24 hour rule. Needs approval from Releases
Projects
No open projects
8.2.x
Fixed in 8.0.0-beta.2
Development

Successfully merging this pull request may close these issues.

None yet

4 participants