Skip to content

Fatal error condition... channel_bootstrap.c:743: bootstrap Debugging and Documentation Question #570

Answered by bretambrose
pwolfe1 asked this question in Q&A
Discussion options

You must be logged in to vote

It's not quite that things need to be local, it's that if you're building something and passing in a reference to an object, then that object needs to outlive what you're building. The samples tend to put everything in a quasi-global (main) scope for simplicity. But unfortunately, given a C++ environment, you need to always be thinking about object lifetimes.

Personally, I wish we'd never allowed by-value construction of complex objects (bootstrap, event loop group, etc..) and only allowed shared_ptr-returning-factory construction and everything configured by shared pointers not direct references. I think the semantics would have been much clearer and safer to use, but unfortunately, that…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@pwolfe1
Comment options

@pwolfe1
Comment options

@bretambrose
Comment options

@pwolfe1
Comment options

Answer selected by pwolfe1
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants