Skip to content

Recording with sf.SoundRecorder results in crash if stop() isn't maually called #129

Description

@intjelic

When subclassing sf.SoundRecorder and we don't manually call stop() after start() was called, it results in segmentation fault.

Here's the code that reproduces the problem on Linux with Cython 0.24.

class MySoundRecorder(sf.SoundRecorder):
    def __init__(self):
        sf.SoundRecorder.__init__(self)

    def on_start(self):
        print("MySoundRecorder.on_start")
        return True

    def on_process_samples(self, samples):
        print("MySoundRecorder.on_process_samples")
        return True

    def on_stop(self):
        print("MySoundRecorder.on_stop")

input("Start recording")
sound_recorder = MySoundRecorder()
sound_recorder.start()
input("Press any key to stop recording")

The result is.

pure virtual method called
terminate called without an active exception
Aborted (core dumped)

However, if I add the line sound_recorder.stop(), the error message isn't displayed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions