-
Notifications
You must be signed in to change notification settings - Fork 287
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
Fixed SEGFAULTs in DartLoader #439
Conversation
Replaced SkeletonPtr() with nullptr.
Is there any particular reason for passing in the |
The Google C++ style guide (see here) advises against using non-const references for output arguments. I tend to agree: it's easy to accidentally pass an argument into an output parameter when calling a function that takes multiple arguments. |
I suppose I can see the logic there. I personally prefer to use references whenever there is no ambiguity about whether the pointer is referring to a There's a legitimate reason for it, so I'm on board. 👍 |
I'm fine with either convention in this case. If you're using non-const references for output parameters elsewhere in DART, then I'd prefer to change this function to be consistent. |
If I've written any functions that have output parameters, they will definitely have used a non-const reference, but truthfully I'm not sure if I've done that in DART yet. We're sort of in the process of redefining the style guide for DART anyway, because the style has been largely Frankensteined over the years. @jslee02 @karenliu Do either of you have a preference for using pointers versus references for output parameters of a function? |
I just pushed another commit that fixes a similar SEGFAULT in |
After poking around through the source code, I've found numerous cases of passing an output parameter by reference instead of pointer. I think many of these uses were written by @jslee02 , so I suspect that might be his preference as well. It's probably worth noting that many of the cases are passing an Eigen::Matrix output parameter by reference, which makes a lot of sense since |
I switched to a a non-const reference output parameter to be consistent with the rest of DART. Is this good to merge once the Travis and Appveyor builds complete? |
It looks like you changed the
|
Ok, fixed for real now. I was exhausted from battling with Assimp for the last few hours and apparently decided to change a random pointer to a reference in |
Looks good. If no one has any objections, I'll merge it in after the CI tests are finished. |
Could we add some regression test for this? |
Sorry for just throwing request but it would be good to have regression test for a fix PR to ensure that the problem is fixed. |
@jslee02 No problem! I've been busy trying to finish up some other code, so I haven't had a chance to write the tests yet. But I hope to get around to it soon if you leave the pull request open. |
Thanks! The test would be good enough if it just checks whether it returns nullptr in the error situations. |
I added unit tests for the error conditions that I fixed. Is there anything else I should do before we can merge this? |
It might be better to dump the test into the existing |
All of the tests other than The parsers have different dependencies ( |
That's fair. Then I'd at least rename it to |
I split the tests into three files: |
I guess the reason I would prefer the name 👍 |
👍 Just waiting for Travis CI to be happy |
DartLoader currently SEGFAULTs if it fails loading a mesh and, possibly, in a few other situations. This pull request adds error-handling logic that prints a
dterr
message and returnsnullptr
in that case.