ObjFW  Check-in [0e35ae63a5]

Overview
Comment:Return Nil for incomplete classes.

It's better to handle the class like it does not even exist in case it
is not completely loaded. Throwing an error there introcudes trouble
with static instances which try to get the class before initializing the
static instances, so objc_lookup_class() should never throw an error.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | runtime
Files: files | file ages | folders
SHA3-256: 0e35ae63a58d4a4b3f05f896a6bed332af289ca43c65ec18db1fad18c8bb1765
User & Date: js on 2012-04-08 15:03:59
Other Links: branch diff | manifest | tags
Context
2012-04-08
20:00
Check if protocol responds to protocol. check-in: 2fab0339e4 user: js tags: runtime
15:03
Return Nil for incomplete classes. check-in: 0e35ae63a5 user: js tags: runtime
14:51
lookup-x86-elf.S: Fix a typo. check-in: d72d924a00 user: js tags: runtime
Changes

Modified src/runtime/class.m from [04350ea410] to [227edc0aad].

220
221
222
223
224
225
226
227
228
229




230
231
232
233
234
235
236
220
221
222
223
224
225
226



227
228
229
230
231
232
233
234
235
236
237







-
-
-
+
+
+
+







	 */
	if (cls->info & OBJC_CLASS_INFO_INITIALIZED) {
		objc_global_mutex_unlock();
		return cls;
	}

	if ((superclass = ((struct objc_abi_class*)cls)->superclass) != NULL) {
		if ((cls->superclass = objc_lookup_class(superclass)) == Nil)
			ERROR("Class %s not found, which is the superclass for "
			    "class %s!", superclass, cls->name);
		if ((cls->superclass = objc_lookup_class(superclass)) == Nil) {
			objc_global_mutex_unlock();
			return Nil;
		}

		cls->isa->superclass = cls->superclass->isa;

		add_subclass(cls);
		add_subclass(cls->isa);
	} else
		cls->isa->superclass = cls;