bugSwarm - Bugs: bug #2362, Map copy method doesn't copy...

 
 

bug #2362: Map copy method doesn't copy compare_t compareFunction

Submitted by:  glen e. p. ropella <gepr>
Submitted on:  Wed 22 Jan 2003 03:15:41 PM UTC  
 
Category:  Swarm Severity:  1 - Wish
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 22 Jan 2003 03:15:41 PM UTC, original submission:  

From: Hendrik de Villiers <hdevil@cs.sun.ac.za>
To: -email is unavailable-
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

glen e. p. ropella <gepr>
Project Administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #252:  main.m added by gepr (1KiB - application/octet-stream - program to demonstrate the bug)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

 

 

No changes have been made to this item

Back to the top


Powered by Savane 3.5