From 94f4d28eb4d0a2cb73581f1483f18bb072c81b4a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 25 May 2014 15:26:21 +0100 Subject: Resolves: fdo#79178 Crash when opening a form created with a previous version A regression from c2c530da69152ff9192b9726aa95961803ce9b29 I think. Rework this to follow the same ctor + init pattern as the others move the fillCache out of the ctor to acquire the obj first, then call the extra init before returning it Change-Id: Ia0dc878654780294a4935f07ac70c4358ca51dfc (cherry picked from commit 637bb5adf7593c26e17e83482e42ccb8fac845a8) --- .../documentacceleratorconfiguration.cxx | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx index 9e72199bc460..d0564c5a625e 100644 --- a/framework/source/accelerators/documentacceleratorconfiguration.cxx +++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx @@ -98,14 +98,14 @@ public: virtual sal_Bool SAL_CALL hasStorage() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE; -private: - /** read all data into the cache. */ - void impl_ts_fillCache(); + void fillCache(); + +private: /** forget all currently cached data AND(!) forget all currently used storages. */ - void impl_ts_clearCache(); + void clearCache(); }; DocumentAcceleratorConfiguration::DocumentAcceleratorConfiguration( @@ -128,8 +128,6 @@ DocumentAcceleratorConfiguration::DocumentAcceleratorConfiguration( css::uno::Reference< css::embed::XStorage >()); } } - - impl_ts_fillCache(); } DocumentAcceleratorConfiguration::~DocumentAcceleratorConfiguration() @@ -150,10 +148,10 @@ void SAL_CALL DocumentAcceleratorConfiguration::setStorage(const css::uno::Refer } if (bForgetOldStorages) - impl_ts_clearCache(); + clearCache(); if (xStorage.is()) - impl_ts_fillCache(); + fillCache(); } sal_Bool SAL_CALL DocumentAcceleratorConfiguration::hasStorage() @@ -163,7 +161,7 @@ sal_Bool SAL_CALL DocumentAcceleratorConfiguration::hasStorage() return m_xDocumentRoot.is(); } -void DocumentAcceleratorConfiguration::impl_ts_fillCache() +void DocumentAcceleratorConfiguration::fillCache() { css::uno::Reference< css::embed::XStorage > xDocumentRoot; { @@ -203,7 +201,7 @@ void DocumentAcceleratorConfiguration::impl_ts_fillCache() {} } -void DocumentAcceleratorConfiguration::impl_ts_clearCache() +void DocumentAcceleratorConfiguration::clearCache() { m_aPresetHandler.forgetCachedStorages(); } @@ -215,7 +213,12 @@ com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation( css::uno::XComponentContext *context, css::uno::Sequence const &arguments) { - return cppu::acquire(new DocumentAcceleratorConfiguration(context, arguments)); + DocumentAcceleratorConfiguration *inst = new DocumentAcceleratorConfiguration(context, arguments); + css::uno::XInterface *acquired_inst = cppu::acquire(inst); + + inst->fillCache(); + + return acquired_inst; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3