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

Capturer::new SIGSEGV on MacOS when called multiple times #38

Open
framp opened this issue Dec 6, 2020 · 0 comments
Open

Capturer::new SIGSEGV on MacOS when called multiple times #38

framp opened this issue Dec 6, 2020 · 0 comments

Comments

@framp
Copy link

framp commented Dec 6, 2020

use scrap::*;

fn main() {
  for i in 1..100 {
    let display = Display::primary()?;
    Capturer::new(display)?;
  }
}

Not that anyone would want to initialise the Capturer several times (I stumbled on this by accident) but I think this is caused by this:

After this call returns, the stream is stopped. When the stream stops, its callback is called
with a status of kCGDisplayStreamFrameStatusStopped. You must wait until this callback is 
received before releasing the display stream object.

https://github.com/quadrupleslap/scrap/blob/master/src/quartz/capturer.rs#L75

I tried keeping a pointer reference and moving

            CFRelease(self.stream);
            dispatch_release(self.queue);

in the handler but it still sigsegv

I guess we would need to wait for the handler to be over inside drop

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