[Libreoffice-commits] core.git: cui/source

Oliver Specht oliver.specht at cib.de
Thu Dec 17 22:49:15 PST 2015


 cui/source/options/optmemory.cxx |   19 +++++++++++++------
 cui/source/options/optmemory.hxx |    3 ++-
 2 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit dcca78f4a720e2d073e49e631b34af3210e0e27f
Author: Oliver Specht <oliver.specht at cib.de>
Date:   Thu Dec 17 11:17:36 2015 +0100

    tdf#93008: use up/down/loseFocusHdl and max cache value fixed
    
    use up/down/loseFocusHdl prevents a change of object cache
    value while writing
    the max. cache value is now set to 2047 MB as this prevents an
    overflow of the configuration value
    
    Change-Id: Ib98f7181b10e2875b2037e425eced3f12ba4c0b6
    Reviewed-on: https://gerrit.libreoffice.org/20766
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Oliver Specht <oliver.specht at cib.de>

diff --git a/cui/source/options/optmemory.cxx b/cui/source/options/optmemory.cxx
index 8cd4298..e3bc437 100644
--- a/cui/source/options/optmemory.cxx
+++ b/cui/source/options/optmemory.cxx
@@ -115,8 +115,10 @@ OfaMemoryOptionsPage::OfaMemoryOptionsPage(vcl::Window* pParent, const SfxItemSe
     : SfxTabPage(pParent, "OptMemoryPage", "cui/ui/optmemorypage.ui", &rSet)
 {
     get(m_pNfGraphicCache, "graphiccache");
-    m_pNfGraphicCache->SetMax(std::numeric_limits< long >::max() >> 20);
+    sal_Int32 maxValue = std::numeric_limits< sal_Int32 >::max() >> 20;
+    m_pNfGraphicCache->SetMax(maxValue);
     get(m_pNfGraphicObjectCache, "objectcache");
+    m_pNfGraphicObjectCache->SetMax(10 * maxValue);
     get(m_pTfGraphicObjectTime,"objecttime");
     get(m_pNfOLECache, "olecache");
     get(m_pQuickStarterFrame, "quickstarter");
@@ -137,7 +139,9 @@ OfaMemoryOptionsPage::OfaMemoryOptionsPage(vcl::Window* pParent, const SfxItemSe
 
     SetExchangeSupport();
 
-    m_pNfGraphicCache->SetModifyHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheConfigHdl ) );
+    m_pNfGraphicCache->SetUpHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheConfigHdl ) );
+    m_pNfGraphicCache->SetDownHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheConfigHdl ) );
+    m_pNfGraphicCache->SetLoseFocusHdl( LINK( this, OfaMemoryOptionsPage, GraphicCacheLoseFocusHdl ) );
 }
 
 OfaMemoryOptionsPage::~OfaMemoryOptionsPage()
@@ -174,7 +178,7 @@ bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet* rSet )
         totalCacheSize, batch);
     sal_Int32 objectCacheSize = GetNfGraphicObjectCacheVal();
     officecfg::Office::Common::Cache::GraphicManager::ObjectCacheSize::set(
-        objectCacheSize, batch);
+        std::min(objectCacheSize, totalCacheSize), batch);
 
     const tools::Time aTime( m_pTfGraphicObjectTime->GetTime() );
     sal_Int32 objectReleaseTime =
@@ -187,7 +191,7 @@ bool OfaMemoryOptionsPage::FillItemSet( SfxItemSet* rSet )
     GraphicManager&     rGrfMgr = aDummyObject.GetGraphicManager();
 
     rGrfMgr.SetMaxCacheSize(totalCacheSize);
-    rGrfMgr.SetMaxObjCacheSize(objectCacheSize, true);
+    rGrfMgr.SetMaxObjCacheSize(std::min(totalCacheSize, objectCacheSize), true);
     rGrfMgr.SetCacheTimeout(objectReleaseTime);
 
     // OLECache
@@ -250,9 +254,12 @@ void OfaMemoryOptionsPage::Reset( const SfxItemSet* rSet )
     m_pQuickLaunchCB->SaveValue();
 }
 
+IMPL_LINK_NOARG_TYPED(OfaMemoryOptionsPage, GraphicCacheLoseFocusHdl, Control&, void)
+{
+    GraphicCacheConfigHdl(*m_pNfGraphicCache);
+}
 
-
-IMPL_LINK_NOARG_TYPED(OfaMemoryOptionsPage, GraphicCacheConfigHdl, Edit&, void)
+IMPL_LINK_NOARG_TYPED(OfaMemoryOptionsPage, GraphicCacheConfigHdl, SpinField&, void)
 {
     sal_Int32 n = GetNfGraphicCacheVal();
     SetNfGraphicObjectCacheMax( n );
diff --git a/cui/source/options/optmemory.hxx b/cui/source/options/optmemory.hxx
index 92d53c4..6415718 100644
--- a/cui/source/options/optmemory.hxx
+++ b/cui/source/options/optmemory.hxx
@@ -41,7 +41,8 @@ private:
     VclPtr<VclContainer>       m_pQuickStarterFrame;
     VclPtr<CheckBox>           m_pQuickLaunchCB;
 
-    DECL_LINK_TYPED(GraphicCacheConfigHdl, Edit&, void);
+    DECL_LINK_TYPED(GraphicCacheConfigHdl, SpinField&, void);
+    DECL_LINK_TYPED(GraphicCacheLoseFocusHdl, Control&, void);
 
     sal_Int32 GetNfGraphicCacheVal() const; // returns # of Bytes
     inline void         SetNfGraphicCacheVal( long nSizeInBytes );


More information about the Libreoffice-commits mailing list