brgl / libgpiod

This is a mirror of the original repository over at kernel.org. This github page is for discussions and issue reporting only. PRs can be discussed here but the patches need to go through the linux-gpio mailing list.
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
Other
306 stars 106 forks source link

shared-ptr deleter is called even if ptr is nullptr (fix #35) #36

Closed pboettch closed 5 years ago

pboettch commented 5 years ago

Could not resist, I'm so impatient :-/.

brgl commented 5 years ago

You're fixing the iter objects - but AFAICT the problem is with the chip object. Was that on purpose?

pboettch commented 5 years ago

Of course not. Sorry.

But seeing again where there are deleters in the binding makes me wonder whether it was correct to create a shared_ptr owning a nullptr in the first place.

brgl commented 5 years ago

Yes, this is my other concern - we should probably check if the C function returned a null pointer and then not initialize the chip object.

pboettch commented 5 years ago

Yes, as you do in chip_iter& chip_iter::operator++(void)

pboettch commented 5 years ago

It's maybe better like this now.

brgl commented 5 years ago

Yes, it looks good now. Can you send it to linux-gpio with [PATCH][libgpiod] tag and your Signed-off-by: tag? I use patchwork for patch management. This github repo is not really the official development tool for me.

pboettch commented 5 years ago

Too bad. GIthub/lab review/pr/merge is so superior to mailing lists-review - IMHO.

But I will try to do it, git-send-email-galore. git-format-patch. Oh lala ;-).

pboettch commented 5 years ago

Of course I messed up the mail. I didn't know how to add the [libgpiod]-tag to the subject-line. So I added it to the commit-message. Re-run format-patch and send send-email the wrong-file.