From 7d485679a317a586c2e0eb20607b2e1158dddaeb Mon Sep 17 00:00:00 2001
From: Caolán McNamara <caolanm@redhat.com>
Date: Thu, 5 May 2011 13:38:55 +0100
Subject: config leaks etc., dispose default component

---
 padmin/source/pamain.cxx | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

(limited to 'padmin')

diff --git a/padmin/source/pamain.cxx b/padmin/source/pamain.cxx
index 7e47e4264d8c..3486f741d471 100644
--- a/padmin/source/pamain.cxx
+++ b/padmin/source/pamain.cxx
@@ -51,6 +51,7 @@ using namespace padmin;
 using namespace cppu;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
+using namespace com::sun::star::frame;
 using namespace comphelper;
 
 using ::rtl::OUString;
@@ -104,10 +105,11 @@ int MyApp::Main()
     //-------------------------------------------------
     // create the global service-manager
     //-------------------------------------------------
+    Reference< XComponentContext > xCtx;
     Reference< XMultiServiceFactory > xFactory;
     try
     {
-        Reference< XComponentContext > xCtx = defaultBootstrap_InitialComponentContext();
+        xCtx = defaultBootstrap_InitialComponentContext();
         xFactory = Reference< XMultiServiceFactory >(  xCtx->getServiceManager(), UNO_QUERY );
         if( xFactory.is() )
             setProcessServiceFactory( xFactory );
@@ -175,6 +177,18 @@ int MyApp::Main()
      */
     ::ucbhelper::ContentBroker::deinitialize();
 
+    /*
+     *  clean up UNO
+     */
+    try
+    {
+        Reference<XComponent> xComp(xCtx, UNO_QUERY_THROW);
+        xComp->dispose();
+    }
+    catch(...)
+    {
+    }
+
     return EXIT_SUCCESS;
 }
 
-- 
cgit