diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-03-21 20:32:16 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-03-21 20:32:47 +0100 |
commit | bc99f1ce4c70aa9f29bcb5b7c7f18f96f44f111c (patch) | |
tree | e9b187c7899fe3f345a84b617eea6e50d945da3c /formula/inc | |
parent | 4762788eb4ab7f2278861aaf9b9d6d665db61310 (diff) |
Ensure ResMgr outlives Resources
Diffstat (limited to 'formula/inc')
-rw-r--r-- | formula/inc/formula/formula.hxx | 9 | ||||
-rw-r--r-- | formula/inc/formula/omoduleclient.hxx | 52 |
2 files changed, 60 insertions, 1 deletions
diff --git a/formula/inc/formula/formula.hxx b/formula/inc/formula/formula.hxx index 17f8fb4c3c89..ac9023ddc665 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 000000000000..23f63c2e74e1 --- /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: */ |