swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug #2362] Map copy method doesn't copy compare_t compareFunction


From: nobody
Subject: [Bug #2362] Map copy method doesn't copy compare_t compareFunction
Date: Wed, 22 Jan 2003 10:15:42 -0500

=================== BUG #2362: FULL BUG SNAPSHOT ===================
http://savannah.nongnu.org/bugs/?func=detailbug&bug_id=2362&group_id=1837

Submitted by: gepr                    Project: Swarm                        
Submitted on: 2003-Jan-22 15:15
Category:  Swarm                      Severity:  1 - Ordinary               
Bug Group:  None                      Resolution:  None                     
Assigned to:  None                    Status:  Open                         

Summary:  Map copy method doesn't copy compare_t compareFunction

Original Submission:  From: Hendrik de Villiers <address@hidden>
To: address@hidden
Subject: Possible problem copying Map collections.
Date: Wed, 22 Jan 2003 13:51:44 +0200


I've come across a possible bug in swarm-2.1.1 . In the Map class's copy 
method (collections/Map.m) , the list is copied alright, but it seems that it 
has been neglected to set the copied map's compare function (compareFunc) to 
the same function as the source Map's compare function.

One my machine, this has the effect of setting the compareFunction of the 
copied map to nil. This would not have been noticable if the objects in the 
Map implemented compare methods, but we are doing quick-n-dirty casting of 
integers to id's, so the default action for a nil compare function (which is 
to invoke the compare method of a given object) generates a segmentation 
fault on this machine.

This should probabily take a one-liner to fix, I am currently working around 
the problem setting the compare function manually using:
  ((Map_c *)theMap)->compareFunc = compareUnsignedIntegers;
It's ugly, and doesn't respect encapsulation, but it got rid of my 
segmentation fault problems.

Anyway, thanks for your attention. Keep up the good work!

Hendrik de Villiers





No Followups Have Been Posted


CC list is empty


File Attachments
****************

-------------------------------------------------------
Date: 2003-Jan-22 15:15  Name: main.m  Size: 1KB   By: gepr
program to demonstrate the bug
http://savannah.nongnu.org/bugs/download.php?group_id=1837&amp;bug_id=2362&amp;bug_file_id=254


For detailed info, follow this link:
http://savannah.nongnu.org/bugs/?func=detailbug&bug_id=2362&group_id=1837

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]