Skip to content

'Illegal call' after alDeleteSources #3

Open
@lynks--

Description

@lynks--

The following example panics during dropping the al resources;

extern crate openal;

struct ALContainer<'a, 'b> {
    pub listener: openal::Listener<'a>,
    pub streams: Vec<openal::source::Stream<'b>>,
}
fn main() {
    let listener = openal::listener::default(
        &openal::listener::Attributes::default()
    ).unwrap();

    let mut streams = Vec::new();
    for _ in 0..4 {
        streams.push(listener.source().unwrap().stream());
    }

    let container = ALContainer {
        listener: listener,
        streams: streams,
    };
}

Specifically;
thread '<main>' panicked at 'Illegal call.', src/source/source.rs:373

Which is the call to alDeleteSources(1, &self.id);

If we do not add the listener and streams to the ALContainer struct, the panic is avoided, so I guess it's something to do with the order in which things are being dropped as they go out of scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions