[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #6743] Distinct NSNumbers with the same value dealloc each other
From: |
nobody |
Subject: |
[bug #6743] Distinct NSNumbers with the same value dealloc each other |
Date: |
Mon, 24 Nov 2003 22:06:22 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030716 |
=================== BUG #6743: FULL BUG SNAPSHOT ===================
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=6743&group_id=99
Submitted by: moseshall Project: GNUstep
Submitted on: Tue 11/25/2003 at 03:06
Category: Base/Foundation Severity: 5 - Major
Bug Group: Bug Resolution: None
Assigned to: None Status: Open
Summary: Distinct NSNumbers with the same value dealloc each other
Original Submission: Distinct NSNumbers with the *same value* can dealloc each
other. The following code snippet crashes gnustep-base 1.7.3 possibly because
of NSNumber caching. If I don't call [n1 release] there is no crash. If this is
due to caching strategy, then it can make NSNumber very fragile when numbers
are expected to persist as long as retained.
#include <Foundation/Foundation.h>
int main (int argc, const char *argv[], const char *env[])
{
NSNumber* n1 = [NSNumber numberWithLong:1];
NSNumber* n2 = [NSNumber numberWithLong:1];
NSLog(@"%@(%d)n", n1, [n1 retainCount]);
NSLog(@"%@(%d)n", n2, [n2 retainCount]);
[n1 release]; //<--problem here
// The next line crashes. n2 has gone away!
NSLog(@"%@(%d)n", n2, [n2 retainCount]);
return 0;
}
Thanks for your attention.
Brian 'Moses' Hall
moses@blugs.com
No Followups Have Been Posted
CC list is empty
No files currently attached
For detailed info, follow this link:
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=6743&group_id=99
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #6743] Distinct NSNumbers with the same value dealloc each other,
nobody <=
- [bug #6743] Distinct NSNumbers with the same value dealloc each other, nobody, 2003/11/25
- [bug #6743] Distinct NSNumbers with the same value dealloc each other, nobody, 2003/11/25
- [bug #6743] Distinct NSNumbers with the same value dealloc each other, nobody, 2003/11/25
- [bug #6743] Distinct NSNumbers with the same value dealloc each other, nobody, 2003/11/25
- [bug #6743] Distinct NSNumbers with the same value dealloc each other, nobody, 2003/11/25
- [bug #6743] Distinct NSNumbers with the same value dealloc each other, nobody, 2003/11/25
- [bug #6743] Distinct NSNumbers with the same value dealloc each other, nobody, 2003/11/25
- [bug #6743] Distinct NSNumbers with the same value dealloc each other, nobody, 2003/11/25