From 3f70410dc3256963b66571396086f257771c25bd Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Tue, 31 Mar 2015 14:49:19 +0200
Subject: [PATCH] Do not fail if server already exists.

---
 src/server.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/server.cc b/src/server.cc
index 9a95940..06e1a74 100644
--- a/src/server.cc
+++ b/src/server.cc
@@ -96,8 +96,12 @@ namespace graphics
       policyList.length(1);
       policyList[0] = PortableServer::ThreadPolicy::_duplicate(threadPolicy);
 
-      private_->poa_ = rootPoa->create_POA
-	("child", PortableServer::POAManager::_nil(), policyList);
+      try {
+        private_->poa_ = rootPoa->create_POA
+          ("child", PortableServer::POAManager::_nil(), policyList);
+      } catch (PortableServer::POA::AdapterAlreadyExists& /*e*/) {
+        private_->poa_ = rootPoa->find_POA ("child", false);
+      }
       // Destroy policy object
       threadPolicy->destroy();
       private_->createAndActivateServers(this);
-- 
GitLab