Closed Bug 1195951 Opened 9 years ago Closed 9 years ago

MediaStreamError contains Heap<T> and is allocated on the stack

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: nika, Assigned: jib)

References

Details

Attachments

(1 file)

dom/media/systemservices/MediaUtils.h:125:15: error: variable of type 'mozilla::dom::MediaStreamError' only valid on the heap
  void Reject(ErrorType rv)
              ^
dom/media/systemservices/MediaUtils.h:125:15: note: value incorrectly allocated in an automatic variable
../../../dist/include/mozilla/dom/MediaStreamError.h:59:7: note: 'mozilla::dom::MediaStreamError' is a heap type because it inherits from a heap type 'nsWrapperCache'
class MediaStreamError final : public nsISupports,
      ^
../../../dist/include/nsWrapperCache.h:352:23: note: 'nsWrapperCache' is a heap type because member 'mWrapper' is a heap type 'JS::Heap<JSObject *>'
  JS::Heap<JSObject*> mWrapper;
                      ^
1 error generated.
(In reply to Michael Layzell [:mystor] from comment #0)
> dom/media/systemservices/MediaUtils.h:125:15: error: variable of type
> 'mozilla::dom::MediaStreamError' only valid on the heap
>   void Reject(ErrorType rv)

I'm not familiar with this code, but I doesn't see how the Reject method is going to work.  It takes an ErrorType template argument and assigns it to an nsRefPtr<ErrorType>, and is used with ErrorType as dom::MediaStreamError in the MediaManager class:

  typedef media::Pledge<SourceSet*, dom::MediaStreamError> PledgeSourceSet;

Maybe it should take an nsRefPtr<ErrorType>?  But I don't really know what's going on here.

Looks like this was added in bug 1173255.  jib, do you know how this works?
Flags: needinfo?(jib)
Bug 1195951 - fix heap type on stack error in MediaUtils' Pledge class
Attachment #8663420 - Flags: review?(rjesup)
This should work better.
Assignee: nobody → jib
Blocks: 912342
Depends on: 1181896
Flags: needinfo?(jib)
Comment on attachment 8663420 [details]
MozReview Request: Bug 1195951 - fix heap type on stack error in MediaUtils' Pledge class

https://reviewboard.mozilla.org/r/19793/#review17769
Attachment #8663420 - Flags: review?(rjesup) → review+
https://hg.mozilla.org/mozilla-central/rev/564f9c049d15
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: