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

Python 3.8: List does not iterate over all members when mutated during loop #16

Open
andrewbest-tri opened this issue Mar 29, 2022 · 1 comment

Comments

@andrewbest-tri
Copy link

for buffer in _buffers:

The above line leaves dangling references in python 3.8 which causes OpenAL to crash.

To reproduce:

for iteration in range(2):
    if not openal.oalGetInit():
            openal.oalInit()
    source1 = openal.oalOpen(path_to_a_sound)
    source2 = openal.oalOpen(path_to_a_sound) 
    source1.play()
    source2.play()
    openal.oalQuit()
    print(len(openal._buffers))  # This will have length 1.

The above code will crash on iteration 2 with INVALID_OPERATION.

@andrewbest-tri
Copy link
Author

workaround for now:

for source in openal._sources:
    source.destroy()
for buffer in openal._buffers:
            buffer.destroy()

before calling quit.

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

1 participant