[Libreoffice-commits] .: formula/inc formula/Library_forui.mk formula/Package_inc.mk formula/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Wed Mar 21 12:34:29 PDT 2012


 formula/Library_forui.mk                |    1 
 formula/Package_inc.mk                  |    1 
 formula/inc/formula/formula.hxx         |    9 ++++-
 formula/inc/formula/omoduleclient.hxx   |   52 ++++++++++++++++++++++++++++++++
 formula/source/ui/dlg/formula.cxx       |    1 
 formula/source/ui/dlg/funcpage.hxx      |    2 -
 formula/source/ui/dlg/omoduleclient.cxx |   43 ++++++++++++++++++++++++++
 formula/source/ui/dlg/parawin.hxx       |    2 -
 formula/source/ui/dlg/structpg.hxx      |    2 -
 formula/source/ui/inc/ModuleHelper.hxx  |   13 --------
 10 files changed, 109 insertions(+), 17 deletions(-)

New commits:
commit bc99f1ce4c70aa9f29bcb5b7c7f18f96f44f111c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 21 20:32:16 2012 +0100

    Ensure ResMgr outlives Resources

diff --git a/formula/Library_forui.mk b/formula/Library_forui.mk
index 660057a..1a42689 100644
--- a/formula/Library_forui.mk
+++ b/formula/Library_forui.mk
@@ -62,6 +62,7 @@ $(eval $(call gb_Library_add_exception_objects,forui,\
     formula/source/ui/dlg/FormulaHelper \
     formula/source/ui/dlg/funcpage \
     formula/source/ui/dlg/funcutl \
+    formula/source/ui/dlg/omoduleclient \
     formula/source/ui/dlg/parawin \
     formula/source/ui/dlg/structpg \
     formula/source/ui/resource/ModuleHelper \
diff --git a/formula/Package_inc.mk b/formula/Package_inc.mk
index 5cb8434..b9aeaa7 100644
--- a/formula/Package_inc.mk
+++ b/formula/Package_inc.mk
@@ -40,6 +40,7 @@ $(eval $(call gb_Package_add_file,formula_inc,inc/formula/funcutl.hxx,funcutl.hx
 $(eval $(call gb_Package_add_file,formula_inc,inc/formula/grammar.hxx,grammar.hxx))
 $(eval $(call gb_Package_add_file,formula_inc,inc/formula/IControlReferenceHandler.hxx,IControlReferenceHandler.hxx))
 $(eval $(call gb_Package_add_file,formula_inc,inc/formula/IFunctionDescription.hxx,IFunctionDescription.hxx))
+$(eval $(call gb_Package_add_file,formula_inc,inc/formula/omoduleclient.hxx,omoduleclient.hxx))
 $(eval $(call gb_Package_add_file,formula_inc,inc/formula/opcode.hxx,opcode.hxx))
 $(eval $(call gb_Package_add_file,formula_inc,inc/formula/tokenarray.hxx,tokenarray.hxx))
 $(eval $(call gb_Package_add_file,formula_inc,inc/formula/token.hxx,token.hxx))
diff --git a/formula/inc/formula/formula.hxx b/formula/inc/formula/formula.hxx
index 17f8fb4..ac9023d 100644
--- a/formula/inc/formula/formula.hxx
+++ b/formula/inc/formula/formula.hxx
@@ -32,6 +32,7 @@
 #include <sfx2/basedlgs.hxx>
 #include <memory>
 #include "formula/formuladllapi.h"
+#include "formula/omoduleclient.hxx"
 
 namespace formula
 {
@@ -87,7 +88,13 @@ protected:
     void            Update(const String& _sExp);
 };
 
-class FORMULA_DLLPUBLIC FormulaDlg :   public SfxModelessDialog
+class FORMULA_DLLPUBLIC FormulaDlg:
+    private OModuleClient, public SfxModelessDialog
+        // order of base classes is important, as OModuleClient controls the
+        // lifecycle of the ResMgr passed into SfxModelessDialog (via
+        // formula::ModuleRes), and at least with DBG_UTIL calling TestRes in
+        // ~Resource, the ResMgr must outlive the Resource (from which
+        // SfxModelessDialog ultimately derives)
 {
     friend class FormulaDlg_Impl;
 public:
diff --git a/formula/inc/formula/omoduleclient.hxx b/formula/inc/formula/omoduleclient.hxx
new file mode 100644
index 0000000..23f63c2
--- /dev/null
+++ b/formula/inc/formula/omoduleclient.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_FORMULA_MODULECLIENT_HXX
+#define INCLUDED_FORMULA_MODULECLIENT_HXX
+
+#include "sal/config.h"
+
+#include "boost/noncopyable.hpp"
+#include "formula/formuladllapi.h"
+
+namespace formula {
+
+/** Base class for objects which use any global module-specific ressources.
+*/
+class FORMULA_DLLPUBLIC OModuleClient: private boost::noncopyable
+{
+public:
+    OModuleClient();
+    ~OModuleClient();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index de692bd..5b9987a 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -154,7 +154,6 @@ namespace formula
         DECL_LINK(FuncSelHdl, void *);
         DECL_LINK(StructSelHdl, void *);
     public:
-        OModuleClient                                           m_aModuleClient;
         mutable uno::Reference< sheet::XFormulaOpCodeMapper>    m_xOpCodeMapper;
         uno::Sequence< sheet::FormulaToken >                    m_aTokenList;
         ::std::auto_ptr<FormulaTokenArray>                      m_pTokenArray;
diff --git a/formula/source/ui/dlg/funcpage.hxx b/formula/source/ui/dlg/funcpage.hxx
index a6542eb..ec75b05 100644
--- a/formula/source/ui/dlg/funcpage.hxx
+++ b/formula/source/ui/dlg/funcpage.hxx
@@ -41,7 +41,7 @@
 
 #include <boost/shared_ptr.hpp>
 #include <vector>
-#include "ModuleHelper.hxx"
+#include "formula/omoduleclient.hxx"
 //============================================================================
 namespace formula
 {
diff --git a/formula/source/ui/dlg/omoduleclient.cxx b/formula/source/ui/dlg/omoduleclient.cxx
new file mode 100644
index 0000000..c18089e
--- /dev/null
+++ b/formula/source/ui/dlg/omoduleclient.cxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "sal/config.h"
+
+#include "formula/omoduleclient.hxx"
+
+#include "ModuleHelper.hxx"
+
+formula::OModuleClient::OModuleClient() {
+    OModule::registerClient();
+}
+
+formula::OModuleClient::~OModuleClient() {
+    OModule::revokeClient();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/formula/source/ui/dlg/parawin.hxx b/formula/source/ui/dlg/parawin.hxx
index 968de86..4a0f496 100644
--- a/formula/source/ui/dlg/parawin.hxx
+++ b/formula/source/ui/dlg/parawin.hxx
@@ -39,8 +39,8 @@
 
 #include <vector>
 #include "formula/funcutl.hxx"
+#include "formula/omoduleclient.hxx"
 #include "ControlHelper.hxx"
-#include "ModuleHelper.hxx"
 
 namespace formula
 {
diff --git a/formula/source/ui/dlg/structpg.hxx b/formula/source/ui/dlg/structpg.hxx
index 8ae7715..74ddec1 100644
--- a/formula/source/ui/dlg/structpg.hxx
+++ b/formula/source/ui/dlg/structpg.hxx
@@ -37,7 +37,7 @@
 #include <vcl/tabctrl.hxx>
 #include <svtools/svtreebx.hxx>
 #include "formula/IFunctionDescription.hxx"
-#include "ModuleHelper.hxx"
+#include "formula/omoduleclient.hxx"
 
 //============================================================================
 
diff --git a/formula/source/ui/inc/ModuleHelper.hxx b/formula/source/ui/inc/ModuleHelper.hxx
index 37a62be..6f10876 100644
--- a/formula/source/ui/inc/ModuleHelper.hxx
+++ b/formula/source/ui/inc/ModuleHelper.hxx
@@ -39,6 +39,7 @@ namespace formula
     //=========================================================================
     //= OModule
     //=========================================================================
+    class OModuleClient;
     class OModuleImpl;
     class FORMULA_DLLPUBLIC OModule
     {
@@ -70,18 +71,6 @@ namespace formula
     };
 
     //=========================================================================
-    //= OModuleClient
-    //=========================================================================
-    /** base class for objects which uses any global module-specific ressources
-    */
-    class FORMULA_DLLPUBLIC OModuleClient
-    {
-    public:
-        OModuleClient()     { OModule::registerClient(); }
-        ~OModuleClient()    { OModule::revokeClient(); }
-    };
-
-    //=========================================================================
     //= ModuleRes
     //=========================================================================
     /** specialized ResId, using the ressource manager provided by the global module


More information about the Libreoffice-commits mailing list