src/driver.h
branchnoai
changeset 10645 8cbdb511a674
parent 10513 33cb70ff2f5d
child 10920 e33442a2b239
--- a/src/driver.h	Mon May 19 14:14:33 2008 +0000
+++ b/src/driver.h	Mon May 19 15:13:58 2008 +0000
@@ -43,7 +43,7 @@
 
 	static Drivers &GetDrivers()
 	{
-		static Drivers s_drivers;
+		static Drivers &s_drivers = *new Drivers();
 		return s_drivers;
 	}
 
@@ -71,7 +71,14 @@
 	 */
 	virtual ~DriverFactoryBase() {
 		if (this->name == NULL) return;
-		GetDrivers().erase(this->name);
+
+		/* Prefix the name with driver type to make it unique */
+		char buf[32];
+		strecpy(buf, GetDriverTypeName(type), lastof(buf));
+		strecpy(buf + 5, this->name, lastof(buf));
+
+		GetDrivers().erase(buf);
+		if (GetDrivers().empty()) delete &GetDrivers();
 		free(this->name);
 	}