[mapguide-commits] r4289 - in trunk/MgDev/Server/src: Common/Base UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Oct 7 17:05:52 EDT 2009


Author: brucedechant
Date: 2009-10-07 17:05:51 -0400 (Wed, 07 Oct 2009)
New Revision: 4289

Modified:
   trunk/MgDev/Server/src/Common/Base/ServiceOperation.cpp
   trunk/MgDev/Server/src/UnitTesting/TestKmlService.cpp
   trunk/MgDev/Server/src/UnitTesting/TestMappingService.cpp
   trunk/MgDev/Server/src/UnitTesting/TestRenderingService.cpp
   trunk/MgDev/Server/src/UnitTesting/TestTileService.cpp
Log:
Fix for trac ticket 1110 - Stability improvements
http://trac.osgeo.org/mapguide/ticket/1110

Notes:
- Update usage of SetCurrentUserInfo() because of the TLS now having a copy of the MgUserInformation


Modified: trunk/MgDev/Server/src/Common/Base/ServiceOperation.cpp
===================================================================
--- trunk/MgDev/Server/src/Common/Base/ServiceOperation.cpp	2009-10-07 19:08:19 UTC (rev 4288)
+++ trunk/MgDev/Server/src/Common/Base/ServiceOperation.cpp	2009-10-07 21:05:51 UTC (rev 4289)
@@ -176,6 +176,10 @@
     Ptr<MgUserInformation> currUserInfo = dynamic_cast<MgUserInformation*>(m_stream->GetObject());
     assert(currUserInfo != NULL);
 
+    // Update the API version
+    currUserInfo->SetApiVersion(m_packet.m_OperationVersion);
+
+    // Set the current MgUserInformation - this makes a TLS copy of the MgUserInformation object
     MgUserInformation::SetCurrentUserInfo(currUserInfo);
     m_packet.m_UserInfo = NULL;
 
@@ -185,7 +189,6 @@
     m_currConnection->SetUserName(currUserInfo->GetUserName());
     m_currConnection->SetSessionId(currUserInfo->GetMgSessionId());
     m_currConnection->SetCurrentOperationStatus(MgConnection::OpUnknown);
-    currUserInfo->SetApiVersion(m_packet.m_OperationVersion);
 
     // Decrement number of arguments since we have pulled the first one.
     m_packet.m_NumArguments--;

Modified: trunk/MgDev/Server/src/UnitTesting/TestKmlService.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestKmlService.cpp	2009-10-07 19:08:19 UTC (rev 4288)
+++ trunk/MgDev/Server/src/UnitTesting/TestKmlService.cpp	2009-10-07 21:05:51 UTC (rev 4289)
@@ -48,12 +48,18 @@
     Ptr<MgUserInformation> userInfo = new MgUserInformation(
         L"Administrator", L"admin");
     userInfo->SetLocale(TEST_LOCALE);
+
+    // Set the current MgUserInformation - this makes a TLS copy of the MgUserInformation object
+    // This must be done before calling CreateSession()
     MgUserInformation::SetCurrentUserInfo(userInfo);
 
     STRING session = svcSite->CreateSession();
     assert(!session.empty());
     userInfo->SetMgSessionId(session);
 
+    // Set the current MgUserInformation - this makes a TLS copy of the MgUserInformation object
+    MgUserInformation::SetCurrentUserInfo(userInfo);
+
     m_siteConnection = new MgSiteConnection();
     m_siteConnection->Open(userInfo);
 }

Modified: trunk/MgDev/Server/src/UnitTesting/TestMappingService.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestMappingService.cpp	2009-10-07 19:08:19 UTC (rev 4288)
+++ trunk/MgDev/Server/src/UnitTesting/TestMappingService.cpp	2009-10-07 21:05:51 UTC (rev 4289)
@@ -50,12 +50,18 @@
     Ptr<MgUserInformation> userInfo = new MgUserInformation(
         L"Administrator", L"admin");
     userInfo->SetLocale(TEST_LOCALE);
+
+    // Set the current MgUserInformation - this makes a TLS copy of the MgUserInformation object
+    // This must be done before calling CreateSession()
     MgUserInformation::SetCurrentUserInfo(userInfo);
 
     STRING session = svcSite->CreateSession();
     assert(!session.empty());
     userInfo->SetMgSessionId(session);
 
+    // Set the current MgUserInformation - this makes a TLS copy of the MgUserInformation object
+    MgUserInformation::SetCurrentUserInfo(userInfo);
+
     m_siteConnection = new MgSiteConnection();
     m_siteConnection->Open(userInfo);
 }

Modified: trunk/MgDev/Server/src/UnitTesting/TestRenderingService.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestRenderingService.cpp	2009-10-07 19:08:19 UTC (rev 4288)
+++ trunk/MgDev/Server/src/UnitTesting/TestRenderingService.cpp	2009-10-07 21:05:51 UTC (rev 4289)
@@ -50,12 +50,18 @@
     Ptr<MgUserInformation> userInfo = new MgUserInformation(
         L"Administrator", L"admin");
     userInfo->SetLocale(TEST_LOCALE);
+
+    // Set the current MgUserInformation - this makes a TLS copy of the MgUserInformation object
+    // This must be done before calling CreateSession()
     MgUserInformation::SetCurrentUserInfo(userInfo);
 
     STRING session = svcSite->CreateSession();
     assert(!session.empty());
     userInfo->SetMgSessionId(session);
 
+    // Set the current MgUserInformation - this makes a TLS copy of the MgUserInformation object
+    MgUserInformation::SetCurrentUserInfo(userInfo);
+
     m_siteConnection = new MgSiteConnection();
     m_siteConnection->Open(userInfo);
 }

Modified: trunk/MgDev/Server/src/UnitTesting/TestTileService.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestTileService.cpp	2009-10-07 19:08:19 UTC (rev 4288)
+++ trunk/MgDev/Server/src/UnitTesting/TestTileService.cpp	2009-10-07 21:05:51 UTC (rev 4289)
@@ -58,12 +58,18 @@
     Ptr<MgUserInformation> userInfo = new MgUserInformation(
         L"Administrator", L"admin");
     userInfo->SetLocale(TEST_LOCALE);
+
+    // Set the current MgUserInformation - this makes a TLS copy of the MgUserInformation object
+    // This must be done before calling CreateSession()
     MgUserInformation::SetCurrentUserInfo(userInfo);
 
     STRING session = svcSite->CreateSession();
     assert(!session.empty());
     userInfo->SetMgSessionId(session);
 
+    // Set the current MgUserInformation - this makes a TLS copy of the MgUserInformation object
+    MgUserInformation::SetCurrentUserInfo(userInfo);
+
     m_siteConnection = new MgSiteConnection();
     m_siteConnection->Open(userInfo);
 }



More information about the mapguide-commits mailing list