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

free(): double free detected in tcache 2 #1

Open
RamblingGeekUK opened this issue May 2, 2020 · 4 comments
Open

free(): double free detected in tcache 2 #1

RamblingGeekUK opened this issue May 2, 2020 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@RamblingGeekUK
Copy link

when I run the sample code, the HAT lights - the wrong colour and crashes with this error... PI3 .net core 3.1

@klemmchr
Copy link
Owner

klemmchr commented May 2, 2020

Could you make a small repro?

@RamblingGeekUK
Copy link
Author

RamblingGeekUK commented May 2, 2020

Thanks for the quick reply. 😁

here is a repo of the code: https://github.com/RamblingGeekUK/led 😀

I'm using the prebuild binary copied to /usr/local/lib and when I run the code I get the following output

image

this is the HAT I'm using : https://www.waveshare.com/wiki/RGB_LED_HAT

@klemmchr
Copy link
Owner

klemmchr commented May 2, 2020

Ok, didn't expect you're using the sample 1:1
I would assume the bug lies around here as there is no point in code where _leds is set to null which could potentially result in a double free of the native handle. However, the dispose pattern is implemented very bad in general. There is no differentiation between native stuff and managed objects. Also the finalizer is missing. Sadly I'm currently busy moving to a new flat so I don't have time to fix it properly. My current advice would be to avoid disposing the strip. Also, disposing is not needed when the program terminates afterwards.

@klemmchr klemmchr self-assigned this May 2, 2020
@klemmchr klemmchr added the bug Something isn't working label May 2, 2020
@RamblingGeekUK
Copy link
Author

RamblingGeekUK commented May 2, 2020

Thanks for taking the time to look into this, very much appreciated. That's stopped it crashing, and the LED's come on, all be it not the colour set.

Yeah sorry, I was just trying to get things working using the sample before moving onwards. 😁

Good luck with the move and be safe -thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants