[haiku-commits] Re: r41717 - haiku/trunk/src/kits/midi

  • From: Philippe Houdoin <philippe.houdoin@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 24 May 2011 22:10:55 +0200

> +       if (be_synth->fClientCount == 0) {
> +               delete be_synth;
> +               be_synth = NULL;
> +       }

Theorically, there is still a race condition on be_synth value here.
What about:

if (be_synth->fClientCount == 0) {
    BMidiSynth* midiSynth = be_synth;
    be_synth = NULL;
    delete midiSynth;
}

?

Other related posts: