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

Question about getState() after stream closed #49

Closed
SchmadenSchmuki opened this issue Jan 16, 2018 · 3 comments
Closed

Question about getState() after stream closed #49

SchmadenSchmuki opened this issue Jan 16, 2018 · 3 comments
Assignees

Comments

@SchmadenSchmuki
Copy link

Both guides, AAudio and Oboe, say after the stream is closed I cannot call its methods.
With AAudio that's what I've experienced. But with Oboe, though I cannot start or stop the stream, (I can call requestStart() or requestStop() without crash,) I can still get informations by calling methods like getState().

So, was I just lucky, things still somewhere in the memory though that wouldn't have to be the case, or is there still something left that is reliable and can be used if needed?
If there is something left, would I have too free that memory at some point (if so how, delete seems strange without having used new) or can I assume it is cleared automatically at some point?
(Needless to say I'm not too experienced in programming)

@dturner
Copy link
Collaborator

dturner commented Jan 17, 2018

What we need is some proper unit tests to test this behaviour. We're working on that at the moment. Thanks for continuing to file issues - it's very helpful to us.

@dturner
Copy link
Collaborator

dturner commented Jan 30, 2018

In AAudio it's simple: When you call close the stream it also deletes the stream, so if you try and dereference the pointer to the stream you'll get undefined behaviour ("use after free").

In Oboe, you can close the oboestream and it will not be deleted. The theory being that you can still query the stream object and its state will be "closed". We need a test to ensure this works.

@dturner dturner self-assigned this Jan 30, 2018
@dturner
Copy link
Collaborator

dturner commented Jul 31, 2018

Unit tests have been added to test the stream after it's been closed. A spreadsheet here shows the return values on closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants