Closed Bug 557776 Opened 14 years ago Closed 14 years ago

js_InitTitle: initialise title->lock properly

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jseward, Assigned: jseward)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

jslock.cpp: js_InitTitle(JSContext *cx, JSTitle *title) initialises
title->lock by memsetting it to zero: PodZero(&title->lock).  This
isn't the official way to do it and gives two problems:

* js_FinishTitle does properly finalise it by calling js_FinishLock.
  As a result, runtime thread checking tools that try to pair up
  lock initialisations and finalisations by watching js_InitLock and
  js_FinishLock report floods of errors about finalisation of a lock
  which was never initialised.

* from reading js_InitLock, PodZero-ing the lock to initialise it is
  only correct in the case "#ifndef NSPR_LOCK".  It's not obviously
  correct when NSPR_LOCK is defined.
Attached patch proposed fixSplinter Review
Attachment #437532 - Flags: review?(jorendorff)
Attachment #437532 - Flags: review?(jorendorff) → review+
Comment on attachment 437532 [details] [diff] [review]
proposed fix

Yes, this is an obvious bug.
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/5343df124795
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: