Skip to content

CPP: Small change to 'Resource not released in destructor'#809

Merged
jbj merged 2 commits into
github:masterfrom
geoffw0:enclosing
Jan 23, 2019
Merged

CPP: Small change to 'Resource not released in destructor'#809
jbj merged 2 commits into
github:masterfrom
geoffw0:enclosing

Conversation

@geoffw0

@geoffw0 geoffw0 commented Jan 21, 2019

Copy link
Copy Markdown
Contributor

Change discussed in #672 (comment). @jbj is right, performance is if anything slightly better (not worse) with getEnclosingElement, given a warmed up cache.

releaseExpr.getEnclosingFunction().getEnclosingAccessHolder*() = acquire.getEnclosingFunction()
// here, `getEnclosingAccessHolder*` allows us to go from a nested function or lambda
// expression to the class method enclosing it.
releaseExpr.getEnclosingElement*() = acquire.getEnclosingFunction()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One detail: this * can be a +. It's probably insignificant here, but I've been bitten by this before -- see 11e03b3.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@jbj jbj merged commit eaa5a5f into github:master Jan 23, 2019
@geoffw0 geoffw0 deleted the enclosing branch May 9, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants