diff options
Diffstat (limited to 'cpp/src/IceGrid/IceGridRegistry.cpp')
-rw-r--r-- | cpp/src/IceGrid/IceGridRegistry.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cpp/src/IceGrid/IceGridRegistry.cpp b/cpp/src/IceGrid/IceGridRegistry.cpp index f6b15394f00..8b41caea87f 100644 --- a/cpp/src/IceGrid/IceGridRegistry.cpp +++ b/cpp/src/IceGrid/IceGridRegistry.cpp @@ -18,6 +18,11 @@ # include <IceGrid/Database.h> # include <IceGrid/WellKnownObjectsManager.h> #endif +#ifdef QTSQL +# include <IceSQL/SqlTypes.h> +# include <QtCore/QCoreApplication> +# include <QtCore/QTextCodec> +#endif using namespace std; using namespace Ice; @@ -31,6 +36,7 @@ class RegistryService : public Service public: RegistryService(); + ~RegistryService(); virtual bool shutdown(); @@ -46,6 +52,9 @@ private: void usage(const std::string&); RegistryIPtr _registry; +#ifdef QTSQL + QCoreApplication* _qtApp; +#endif }; } // End of namespace IceGrid @@ -54,6 +63,17 @@ RegistryService::RegistryService() { } +RegistryService::~RegistryService() +{ +#ifdef QTSQL + if(_qtApp != 0) + { + delete _qtApp; + _qtApp = 0; + } +#endif +} + bool RegistryService::shutdown() { @@ -121,6 +141,7 @@ RegistryService::start(int argc, char* argv[]) out << "you should set individual adapter thread pools instead."; } + TraceLevelsPtr traceLevels = new TraceLevels(communicator(), "IceGrid.Registry"); _registry = new RegistryI(communicator(), traceLevels, nowarn, readonly); @@ -163,6 +184,15 @@ RegistryService::initializeCommunicator(int& argc, char* argv[], // initData.properties->setProperty("Ice.Default.CollocationOptimized", "0"); +#ifdef QTSQL + if(QCoreApplication::instance() == 0) + { + _qtApp = new QCoreApplication(argc, argv); + QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + } + initData.threadHook = new IceSQL::ThreadHook(); +#endif + return Service::initializeCommunicator(argc, argv, initData); } |