diff options
author | Richard Frith-Macdonald <rrfm@gnu.org> | 2001-06-08 22:19:47 +0000 |
---|---|---|
committer | Stan Shebs <shebs@gcc.gnu.org> | 2001-06-08 22:19:47 +0000 |
commit | e6be21fe8783be5abd5c15b74b9be457a3095ec9 (patch) | |
tree | f0c91e12a488c83a75cdce0865034ef7d50e6df6 /libobjc | |
parent | 43fd108f69a0a0da4e929372f2809e5ad273850b (diff) | |
download | gcc-e6be21fe8783be5abd5c15b74b9be457a3095ec9.zip gcc-e6be21fe8783be5abd5c15b74b9be457a3095ec9.tar.gz gcc-e6be21fe8783be5abd5c15b74b9be457a3095ec9.tar.bz2 |
init.c (__objc_send_message_in_list): When setting a new entry in __objc_load_methods use the method IMP as key...
2001-06-06 Richard Frith-Macdonald <rrfm@gnu.org>
* init.c (__objc_send_message_in_list): When setting a new entry
in __objc_load_methods use the method IMP as key, but check to see
if the method is in the hashtable by looking at the IMP also.
Also ... call the method after adding it to the hashtable rather
than before ... thus preventing an obscure possibility of infinite
recursion if a +load method itself loads a subclass.
From-SVN: r43052
Diffstat (limited to 'libobjc')
-rw-r--r-- | libobjc/ChangeLog | 9 | ||||
-rw-r--r-- | libobjc/init.c | 10 |
2 files changed, 14 insertions, 5 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 4558566..ce7f413 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,12 @@ +2001-06-06 Richard Frith-Macdonald <rrfm@gnu.org> + + * init.c (__objc_send_message_in_list): When setting a new entry + in __objc_load_methods use the method IMP as key, but check to see + if the method is in the hashtable by looking at the IMP also. + Also ... call the method after adding it to the hashtable rather + than before ... thus preventing an obscure possibility of infinite + recursion if a +load method itself loads a subclass. + 2001-05-25 Ovidiu Predescu <ovidiu@cup.hp.com> * init.c (__objc_send_message_in_list): When setting a new entry diff --git a/libobjc/init.c b/libobjc/init.c index d50dba0..29ce639 100644 --- a/libobjc/init.c +++ b/libobjc/init.c @@ -313,16 +313,16 @@ __objc_send_message_in_list (MethodList_t method_list, Class class, SEL op) Method_t mth = &method_list->method_list[i]; if (mth->method_name && sel_eq (mth->method_name, op) - && !hash_is_key_in_hash (__objc_load_methods, mth->method_name)) + && !hash_is_key_in_hash (__objc_load_methods, mth->method_imp)) { - /* The method was found and wasn't previously executed. */ - (*mth->method_imp) ((id)class, mth->method_name); - /* Add this method into the +load hash table */ - hash_add (&__objc_load_methods, mth->method_name, mth->method_imp); + hash_add (&__objc_load_methods, mth->method_imp, mth->method_imp); DEBUG_PRINTF ("sending +load in class: %s\n", class->name); + /* The method was found and wasn't previously executed. */ + (*mth->method_imp) ((id)class, mth->method_name); + break; } } |