diff --git a/GNUmakefile b/GNUmakefile index e3063d8..c54cfcf 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -120,14 +120,14 @@ endif include $(GNUSTEP_MAKEFILES)/aggregate.make include $(GNUSTEP_MAKEFILES)/library.make -all:: +build-opts: @echo Building LLVM optimisation passes... @sh build_opts.sh $(MAKE) all -install:: +install-opts: build_opts @echo Installing LLVM optimisation passes... @sh build_opts.sh $(MAKE) install -clean:: +clean-opts: @echo Cleaning LLVM optimisation passes... @sh build_opts.sh $(MAKE) clean diff --git a/runtime.c b/runtime.c index 22bf00a..67d75fb 100644 --- a/runtime.c +++ b/runtime.c @@ -534,6 +534,8 @@ static void freeIvarLists(Class aClass) */ static inline void safe_remove_from_subclass_list(Class cls) { + // If this class hasn't been added to the class hierarchy, then this is easy + if (!objc_test_class_flag(cls, objc_class_flag_resolved)) { return; } Class sub = cls->super_class->subclass_list; if (sub == cls) { @@ -569,8 +571,14 @@ void objc_disposeClassPair(Class cls) freeMethodLists(cls); freeMethodLists(meta); freeIvarLists(cls); - free_dtable(cls->dtable); - free_dtable(meta->dtable); + if (cls->dtable != uninstalled_dtable) + { + free_dtable(cls->dtable); + } + if (meta->dtable != uninstalled_dtable) + { + free_dtable(meta->dtable); + } // Free the class and metaclass free(meta);