mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 20:25:44 +00:00
Bug 865004 - Disconnect the AudioNode from the graph before deleting it; r=bzbarsky
This commit is contained in:
parent
723c197a05
commit
bae9f2a9a4
@ -23,11 +23,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(AudioNode, nsDOMEventTargetHel
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOutputNodes)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(AudioNode, nsDOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(AudioNode, nsDOMEventTargetHelper)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(AudioNode)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
|
||||
|
||||
AudioNode::AudioNode(AudioContext* aContext)
|
||||
: mContext(aContext)
|
||||
{
|
||||
@ -38,11 +33,21 @@ AudioNode::AudioNode(AudioContext* aContext)
|
||||
|
||||
AudioNode::~AudioNode()
|
||||
{
|
||||
DisconnectFromGraph();
|
||||
MOZ_ASSERT(mInputNodes.IsEmpty());
|
||||
MOZ_ASSERT(mOutputNodes.IsEmpty());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
AudioNode::Release()
|
||||
{
|
||||
if (mRefCnt.get() == 1) {
|
||||
// We are about to be deleted, disconnect the object from the graph before
|
||||
// the derived type is destroyed.
|
||||
DisconnectFromGraph();
|
||||
}
|
||||
return nsDOMEventTargetHelper::Release();
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
FindIndexOfNode(const nsTArray<AudioNode::InputNode>& aInputNodes, const AudioNode* aNode)
|
||||
{
|
||||
|
@ -73,9 +73,12 @@ private:
|
||||
class AudioNode : public nsDOMEventTargetHelper,
|
||||
public EnableWebAudioCheck
|
||||
{
|
||||
protected:
|
||||
// You can only use refcounting to delete this object
|
||||
virtual ~AudioNode();
|
||||
|
||||
public:
|
||||
explicit AudioNode(AudioContext* aContext);
|
||||
virtual ~AudioNode();
|
||||
|
||||
// This should be idempotent (safe to call multiple times).
|
||||
virtual void DestroyMediaStream();
|
||||
@ -87,7 +90,8 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_IMETHOD_(nsrefcnt) Release() MOZ_OVERRIDE;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AudioNode,
|
||||
nsDOMEventTargetHelper)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user