← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3287: fix crashes when multiple dwt plugins are loaded

 

------------------------------------------------------------
revno: 3287
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2013-05-05 15:29:21 +0200
message:
  fix crashes when multiple dwt plugins are loaded
modified:
  dwt/src/Dispatcher.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dwt/src/Dispatcher.cpp'
--- dwt/src/Dispatcher.cpp	2013-01-18 21:28:38 +0000
+++ dwt/src/Dispatcher.cpp	2013-05-05 13:29:21 +0000
@@ -37,6 +37,12 @@
 #include <algorithm>
 #include <sstream>
 
+#ifdef DWT_SHARED
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/random_generator.hpp>
+#include <boost/uuid/uuid_io.hpp>
+#endif
+
 namespace dwt {
 
 LRESULT CALLBACK WindowProc::initProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
@@ -222,8 +228,12 @@
 
 #ifdef DWT_SHARED
 	/* in a shared library, classes registered by the lib can't clash with those regged by the host
-	or by other dynamically loaded libs. append a (hopefully unique) string to that end... */
-	stream << &Application::instance();
+	or by other dynamically loaded libs. append a unique string to that end. */
+	static boost::uuids::uuid uuid;
+	if(uuid.is_nil()) {
+		uuid = boost::uuids::random_generator()();
+	}
+	stream << uuid;
 #endif
 
 	classNames.push_back(stream.str());