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

prevent crashes during completion of callbacks on disposed SoundFiles #320

Merged
merged 2 commits into from
Sep 11, 2018

Conversation

Spongman
Copy link
Contributor

  • adds some checks to SoundFile callbacks to prevent crashes during async callbacks completing on disposed objects
  • moves loadSound call to preload() in doc sample

@@ -221,9 +221,11 @@ define(function (require) {
request.onload = function() {
if (request.status === 200) {
// on sucess loading file:
if (!self.panner) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does the trick, but I wonder if there's a better way to check if the soundfile has been disposed. Or, better yet, to cancel any incomplete callbacks when the soundfile is disposed.

* mySound = loadSound('assets/doorbell.mp3');
*
* }
* function setup() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 sorry for the trouble here!

@therewasaguy therewasaguy merged commit 429b953 into processing:master Sep 11, 2018
therewasaguy added a commit that referenced this pull request Sep 11, 2018
therewasaguy added a commit to processing/p5.js that referenced this pull request Sep 11, 2018
therewasaguy added a commit to processing/p5.js that referenced this pull request Sep 11, 2018
* fix #3200 soundfile dispose error in reference test
Thanks, @Spongman, for the fix here: processing/p5.js-sound#320

* patch convolverNode dispose
processing/p5.js-sound#321
@Spongman Spongman deleted the fix-callback-crash branch September 21, 2018 23:22
mrjoshida pushed a commit to mrjoshida/p5.js-sound that referenced this pull request Sep 30, 2018
* 'master' of ssh://github.com/mrjoshida/p5.js-sound:
  rebuild lib
  dispose of ConvolverNode before resetting buffer (processing#321)
  rebuild lib with reference example fix processing#320
  move loadSound call to preload
  prevent crashes during completion of callbacks on disposed SoundFiles
  0.3.9
  add soundfile.save example
  add `save()` and `getBlob()` methods to SoundFile. Move .wav conversion to helpers.js (processing#315)
  Added saveSoundToBlob() to soundRecorder.js
  Document properties of AudioIn
  update master limiter - sharp knee
  monosynth: remove unused _isOn
  monosynth: remove unused filter, patch velocity
  Missed this fragment during the renaming
  corrected formatting by replacing tabs with four spaces
  fixed issue: processing/p5.js-sound#297
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

Successfully merging this pull request may close these issues.

2 participants