Closed Bug 1544852 Opened 6 years ago Closed 6 years ago

ScopeData destructors are not called

Categories

(Core :: JavaScript: GC, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 file)

When scopes are finalized their data is freed rather than deleted, as follows:

void Scope::finalize(FreeOp* fop) {
  MOZ_ASSERT(CurrentThreadIsGCSweeping());
  if (data_) {
    // We don't need to call the destructors for any GCPtrs in Data because
    // this only happens during a GC.
    fop->free_(data_);
    data_ = nullptr;
  }
}

This seems pretty dubious. At the very least we want GCPtr destructors to run in debug builds because they have assertions that we would like checked. (It is true that GCPtr destructors do nothing in release builds).

The patch casts the base class pointer to the correct type and deletes it. Happily very little code (~20 instructions) is generated in opt builds where these destructors are basically no-ops.

Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/e3cd7a936c71 Call scope data destructors from the finalizer r=tcampbell

The bot thinks this bug is a task, but please change it back in case of error.

Type: defect → task
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: