PR_ImportFile, etc. should initialize NSPR implicitly.

CLOSED FIXED

Status

defect
P2
normal
CLOSED FIXED
21 years ago
20 years ago

People

(Reporter: wtc, Assigned: wtc)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

21 years ago
This bug is reported by John McMullen (mcmullen@netscape.com).

PR_ImportFile, PR_ImportTCPSocket, and PR_ImportUDPSocket
are not initializing NSPR implicitly.  So if PR_ImportFile
is the first NSPR function your program calls, your program
will trigger this assertion failure (in a debug build):
Assertion failure: NULL != _pr_fd_cache.stack, at prfdcach.c:77
Abort (core dumped)

The fix is to add the following line to the beginning of
PR_ImportFile, PR_ImportTCPSocket, and PR_ImportUDPSocket:
    if (!_pr_initialized) _PR_ImplicitInitialization();

A workaround is to add a dummy PR_GetCurrentThread() call
before your PR_ImportFile call.  The PR_GetCurrentThread()
call forces NSPR to initialize.
(Assignee)

Updated

21 years ago
Status: NEW → RESOLVED
Last Resolved: 21 years ago
Resolution: --- → FIXED
(Assignee)

Comment 1

21 years ago
Fixed on the tip.
/cvsroot/mozilla/nsprpub/pr/src/io/prfile.c, revision 3.9.
/cvsroot/mozilla/nsprpub/pr/src/io/prsocket.c, revision 3.11.
/cvsroot/mozilla/nsprpub/pr/src/pthreads/ptio.c, revision 3.10.

(Also fixed in the internal cvs repository:
/m/src/ns/nspr20/pr/src/io/prfile.c, revision 2.12.
/m/src/ns/nspr20/pr/src/io/prsocket.c, revision 2.22.
/m/src/ns/nspr20/pr/src/pthreads/ptio.c, revision 2.42.)
(Assignee)

Updated

21 years ago
Status: RESOLVED → CLOSED
(Assignee)

Comment 2

21 years ago
Closed the bug.

Comment 3

20 years ago
NSPR now has its own Bugzilla product.  Moving this bug to the NSPR product.
You need to log in before you can comment on or make changes to this bug.