[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #39088] Suppressing warnings in the GSWeb build
From: |
Sebastian Reitenbach |
Subject: |
[bug #39088] Suppressing warnings in the GSWeb build |
Date: |
Thu, 30 May 2013 08:34:06 +0000 |
User-agent: |
Mozilla/5.0 (X11; OpenBSD amd64; rv:18.0) Gecko/20100101 Firefox/18.0 |
Update of bug #39088 (project gnustep):
Status: None => Need Info
Assigned to: None => buzzdee
_______________________________________________________
Follow-up Comment #3:
Hi Graham,
i applied all chunks of the patch, but one, where I think its wrong.
In the last hunk in your patch to -GSWeb/GSWMultiKeyDictionary.m, you cast
from a superclass to a subclass, which I think its not safe. AFAIK, casting is
only fiddling with pointers, but its not
really changing the type of class that you are casting. So if someone now
calls a method implemented in NSMutableArray, it will probably fail miserably.
Only when you are sure, nothing in the code will call methods from the
subclass, then it might be safe to cast from superclass to subclass. But in
the code I see some lines below in -nextObject, calling -removeLastObject on
the casted class, and I guess that would fail then.
I think casting is only safe the other way around, casting from a subclass to
a superclass.
Anyways, so instead of your cast:
ASSIGN(_objects,(NSMutableDictionary *)[_dictionary allValues]);
I'd better correctly initialize an mutable array:
_objects = [NSMutableArray arrayWithArray:[_dictionary allValues]];
But since memory management is still something I not fully grasped yet, it may
be I have to add a -retain to the line, or some autorelease or whatnot?
Attached my version of solving the problem. If somebody can tell me its OK, or
if I need a retain or something, then I'd go on commit that instead. Or if
someone tells me that my assumptions are totally wrong above, and your patch
is just right ;)
cheers
(file #28208)
_______________________________________________________
Additional Item Attachment:
File name: patch-GSWeb_GSWMultiKeyDictionary_m Size:0 KB
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?39088>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/