diff src/common/Module.cpp @ 1125:05f0d0e44cd5

Don't throw exception when loading module in thread. The module registry throws an exception when trying to register a module instances if an instance is already registered under the same name. This backfired in love.thread when requiring love-modules.
author vrld <vrld@vrld.org>
date Mon, 10 Sep 2012 12:39:37 +0200
parents 3c6206da8bcf
children b7f097053d74
line wrap: on
line diff
--- a/src/common/Module.cpp	Tue Aug 28 17:47:23 2012 +0200
+++ b/src/common/Module.cpp	Mon Sep 10 12:39:37 2012 +0200
@@ -42,8 +42,13 @@
 		std::string name(instance->getName());
 
 		std::map<std::string, Module*>::iterator it = registry.find(name);
+
 		if (registry.end() != it)
+		{
+			if (it->second == instance)
+				return;
 			throw Exception("Module %s already registered!", instance->getName());
+		}
 
 		registry.insert(make_pair(name, instance));
 	}