bugGNUstep - Bugs: bug #25720, validateValue:forKey:error broken...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #25720: validateValue:forKey:error broken in base-1.18

Submitted by:  Michael Johnston <mjohnston>
Submitted on:  Fri 27 Feb 2009 11:51:56 AM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri 27 Feb 2009 01:39:27 PM UTC, comment #2:

Do unto others ... ;-)

Michael Johnston <mjohnston>
Fri 27 Feb 2009 12:56:57 PM UTC, comment #1:

Thanks ... wonderful bug report identifying exact problem , and with a solution too!
I added a call to -respondsToSelector: in svn. The fix will be in the next release.

Richard Frith-Macdonald <CaS>
Project Member
Fri 27 Feb 2009 11:51:56 AM UTC, original submission:

Library version - gnustep-startup-0.22
gcc version - 4.3.2
OS - Fedora Core 10

Expected Behaviour

validateValue:forKey:error: should return YES by default if the receiver doesn't implement key-value validation for the key.

Actual Behaviour:

validateValue:forKey:error tries to call validate$KEY:error whether or not the reciver implements the method. This causes an exception to be raised.

Regression:

This problem does not exist in previous version of base.

Reason:

I think this may be due to a difference in behaviour between using sel_get_uid (via GSSelectorFromName()) in 1.18) and sel_get_any_uid used in previous versions.

In 1.18 validateValue:forKey:error uses the return value of GSSelectorFromName to decide whether to obtain a pointer to the method via methodForSelector: and call it.
However it seems that this function returns a selector regardless of whether such a method exists or not, whereas previously sel_get_any_uid would return 0 if the selector wasn't valid.

Next methodForSelector: returns a IMP for the (invalid) selector - it never checks it svalidity as it only expects real selectors. Finally the function pointer is called and the exception raised.

Possible Solution:

Add a respondsToSelector: call after obtaining the selector.

Michael Johnston <mjohnston>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by mjohnston (Submitted the item)
  •  

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 27 Feb 2009 12:56:57 PM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1