Closed
Bug 164294
Opened 23 years ago
Closed 23 years ago
NTBUCKETS returns 1 for an empty hash table
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
INVALID
People
(Reporter: mkaply, Assigned: dougt)
Details
Attachments
(1 file)
577 bytes,
text/plain
|
Details |
See
http://lxr.mozilla.org/seamonkey/source/nsprpub/lib/ds/plhash.c#425
If you call an enumerate function on an empty hash table, it crashes.
It shouldn't. The problem is that the NTBUCKETS macro is returning 1 even though
the hash table is empty.
Comment 1•23 years ago
|
||
Michael,
I don't understand this bug. As this test program
demonstrates, I can enumerate an empty hash table
without crashing. The PL_HashTableEnumerateEntries
correctly returns 0.
Reporter | ||
Comment 2•23 years ago
|
||
Interesting. Maybe the problem is only with a hash table created with
nsHashTable (XPCOM)
I create an nsHashTable hashtable;
and if I try to enumerate on it, I crash.
I'll move this to XPCOM.
Assignee: wtc → dougt
Component: NSPR → XPCOM
Product: NSPR → Browser
QA Contact: wtc → scc
Version: 4.3 → other
Assignee | ||
Comment 3•23 years ago
|
||
Mike, do you have a test case which demonstrates this crash you are seeing?
Reporter | ||
Comment 4•23 years ago
|
||
Not exactly. I'll create one.
We found it when creating a hashtable for our font code.
We put an nsHashTable in a class (not a pointer)
then we added code at shutdown that enumerated the hashtable and freed the entries.
What we found is that if we had not added anything, the ::enumerate still called
into NSPR.
Reporter | ||
Comment 5•23 years ago
|
||
My bad.
A static initializer wasn't getting called because we wrote our own DLL init
function.
This was masquerading as this problem.
nsHashTables always have 16 by default - it's in the default constructor.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•