Skip to content

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

@framp

Description

@framp
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

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