[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - 2 commits - editeng/source filter/source sc/inc sc/source sdext/source sd/source svtools/source toolkit/source vcl/source
Michael Meeks
michael.meeks at collabora.com
Wed May 27 05:58:38 PDT 2015
editeng/source/editeng/impedit.hxx | 2 +-
filter/source/graphicfilter/eos2met/eos2met.cxx | 2 +-
filter/source/graphicfilter/idxf/dxf2mtf.cxx | 2 +-
filter/source/svg/svgwriter.cxx | 2 +-
sc/inc/progress.hxx | 4 ++++
sc/source/core/data/column2.cxx | 17 +++++++++++++++++
sc/source/core/data/formulacell.cxx | 8 ++++++--
sc/source/core/tool/progress.cxx | 13 ++++++++-----
sc/source/ui/docshell/sizedev.cxx | 2 +-
sc/source/ui/view/gridwin4.cxx | 2 +-
sd/source/filter/eppt/pptx-text.cxx | 2 +-
sdext/source/pdfimport/wrapper/wrapper.cxx | 6 +++---
svtools/source/control/ctrlbox.cxx | 2 +-
toolkit/source/awt/vclxtoolkit.cxx | 2 +-
vcl/source/edit/texteng.cxx | 2 +-
vcl/source/edit/textview.cxx | 2 +-
vcl/source/filter/wmf/wmfwr.cxx | 2 +-
vcl/source/gdi/impanmvw.cxx | 6 +++---
18 files changed, 53 insertions(+), 25 deletions(-)
New commits:
commit f34c1e9ba7d831c42c89d3c59d501ce6cc858dbe
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Tue May 26 16:02:50 2015 +0100
tdf#91416 - fix some incorrectly allocated VirtualDevices.
Change-Id: I9ebed313827986473c60e77b7e218b4c1b2487fe
(cherry picked from commit f849d96463d967214bc063f6de912a082272c395)
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 93f2b8f..d08ee75 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -1069,7 +1069,7 @@ inline EditSelection ImpEditEngine::CreateSel( const ESelection& rSel )
inline VirtualDevice* ImpEditEngine::GetVirtualDevice( const MapMode& rMapMode, DrawModeFlags nDrawMode )
{
if ( !pVirtDev )
- pVirtDev = new VirtualDevice;
+ pVirtDev = VclPtr<VirtualDevice>::Create();
if ( ( pVirtDev->GetMapMode().GetMapUnit() != rMapMode.GetMapUnit() ) ||
( pVirtDev->GetMapMode().GetScaleX() != rMapMode.GetScaleX() ) ||
diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx
index abda124..3acff99 100644
--- a/filter/source/graphicfilter/eos2met/eos2met.cxx
+++ b/filter/source/graphicfilter/eos2met/eos2met.cxx
@@ -262,7 +262,7 @@ public:
if( !pCompDev )
{
apDummyVDev.disposeAndClear();
- apDummyVDev.reset( new VirtualDevice );
+ apDummyVDev.reset( VclPtr<VirtualDevice>::Create() );
pCompDev = apDummyVDev.get();
}
}
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
index d02c389..3dd97e2 100644
--- a/filter/source/graphicfilter/idxf/dxf2mtf.cxx
+++ b/filter/source/graphicfilter/idxf/dxf2mtf.cxx
@@ -776,7 +776,7 @@ bool DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF
const DXFLayer * pLayer;
const DXFVPort * pVPort;
- pVirDev = new VirtualDevice;
+ pVirDev = VclPtr<VirtualDevice>::Create();
pDXF = &rDXF;
bStatus = true;
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 16f3fc9..56c5f76 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1652,7 +1652,7 @@ SVGActionWriter::SVGActionWriter( SVGExport& rExport, SVGFontExport& rFontExport
mbClipAttrChanged( false ),
mbIsPlaceholderShape( false )
{
- mpVDev = new VirtualDevice;
+ mpVDev = VclPtr<VirtualDevice>::Create();
mpVDev->EnableOutput( false );
maTargetMapMode = MAP_100TH_MM;
maTextWriter.setVirtualDevice( mpVDev, maTargetMapMode );
diff --git a/sc/source/ui/docshell/sizedev.cxx b/sc/source/ui/docshell/sizedev.cxx
index 744266e..90bca78 100644
--- a/sc/source/ui/docshell/sizedev.cxx
+++ b/sc/source/ui/docshell/sizedev.cxx
@@ -39,7 +39,7 @@ ScSizeDeviceProvider::ScSizeDeviceProvider( ScDocShell* pDocSh )
}
else
{
- pDevice = new VirtualDevice;
+ pDevice = VclPtr<VirtualDevice>::Create();
pDevice->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() );
bOwner = true;
}
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index c175d02..bfda05a 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -498,7 +498,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
// #i45033# For OLE inplace editing with different zoom factors,
// use a virtual device with 1/100th mm as text formatting reference
- xFmtVirtDev.reset( new VirtualDevice );
+ xFmtVirtDev.reset( VclPtr<VirtualDevice>::Create() );
xFmtVirtDev->SetMapMode( MAP_100TH_MM );
aOutputData.SetFmtDevice( xFmtVirtDev.get() );
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index cfbf7a6..a890199 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -1432,7 +1432,7 @@ sal_uInt32 FontCollection::GetId( FontCollectionEntry& rEntry )
aFont.SetHeight( 100 );
if ( !pVDev )
- pVDev = new VirtualDevice;
+ pVDev = VclPtr<VirtualDevice>::Create();
pVDev->SetFont( aFont );
FontMetric aMetric( pVDev->GetFontMetric() );
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index aa0cf96..4215163 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -660,9 +660,9 @@ void Parser::readFont()
}
- static VirtualDevice* vDev = 0;
- if (vDev == 0)
- vDev = new VirtualDevice;
+ static VclPtr<VirtualDevice> vDev;
+ if (!vDev)
+ vDev = VclPtr<VirtualDevice>::Create();
vcl::Font font(aResult.familyName, Size(0, 1000));
vDev->SetFont(font);
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 9b7bb59..5414eaf 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -725,7 +725,7 @@ LineListBox::LineListBox( vcl::Window* pParent, WinBits nWinStyle ) :
ListBox( pParent, nWinStyle ),
m_nWidth( 5 ),
m_sNone( ),
- aVirDev( new VirtualDevice ),
+ aVirDev( VclPtr<VirtualDevice>::Create() ),
aColor( COL_BLACK ),
maPaintCol( COL_BLACK )
{
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 9ef383d..5962c95 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -731,7 +731,7 @@ void SAL_CALL VCLXToolkit::disposing()
SolarMutexGuard aSolarGuard;
- VirtualDevice* pV = new VirtualDevice;
+ VclPtrInstance<VirtualDevice> pV;
pV->SetOutputSizePixel( Size( Width, Height ) );
pVDev->SetVirtualDevice( pV );
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index a725932..812b9b5 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -93,7 +93,7 @@ TextEngine::TextEngine()
mpIdleFormatter = new IdleFormatter;
mpIdleFormatter->SetIdleHdl( LINK( this, TextEngine, IdleFormatHdl ) );
- mpRefDev = new VirtualDevice;
+ mpRefDev = VclPtr<VirtualDevice>::Create();
ImpInitLayoutMode( mpRefDev );
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 691fba8..0720fd4 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -529,7 +529,7 @@ VirtualDevice* TextView::GetVirtualDevice()
{
if ( !mpImpl->mpVirtDev )
{
- mpImpl->mpVirtDev = new VirtualDevice;
+ mpImpl->mpVirtDev = VclPtr<VirtualDevice>::Create();
mpImpl->mpVirtDev->SetLineColor();
}
return mpImpl->mpVirtDev;
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 8e6040f..83b98ce 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1710,7 +1710,7 @@ bool WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream,
bEmbedEMF = true;
bStatus=true;
- pVirDev = new VirtualDevice;
+ pVirDev = VclPtr<VirtualDevice>::Create();
if (pFConfigItem)
{
diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx
index b225280..9d7cea0b 100644
--- a/vcl/source/gdi/impanmvw.cxx
+++ b/vcl/source/gdi/impanmvw.cxx
@@ -33,8 +33,8 @@ ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* pOut,
maSz ( rSz ),
maSzPix ( mpOut->LogicToPixel( maSz ) ),
maClip ( mpOut->GetClipRegion() ),
- mpBackground ( new VirtualDevice ),
- mpRestore ( new VirtualDevice ),
+ mpBackground ( VclPtr<VirtualDevice>::Create() ),
+ mpRestore ( VclPtr<VirtualDevice>::Create() ),
meLastDisposal ( DISPOSE_BACK ),
mbPause ( false ),
mbMarked ( false ),
@@ -217,7 +217,7 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev )
// get output device
if( !pVDev )
{
- pDev = new VirtualDevice;
+ pDev = VclPtr<VirtualDevice>::Create();
pDev->SetOutputSizePixel( maSzPix, false );
pDev->DrawOutDev( Point(), maSzPix, maDispPt, maDispSz, *mpOut );
}
commit 3a34f96a16ad3063302670a57a1ed508302e3ffb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed May 27 13:52:36 2015 +0100
Resolves: tdf#91416 setting progress -> resize -> destroy formula context
i.e. setting progress triggers ScTabView::DoResize and an InterpretVisible and
InterpretDirtyCells which resets the mpFormulaGroupCxt that the current rCxt
points to, which is bad, so disable progress for the duration of the GetResult
loop
Change-Id: I8e88cee4dd2308ef61dee934d300a38978833703
(cherry picked from commit e3c1a394a00cef416a81b89b6d5c204891abb286)
diff --git a/sc/inc/progress.hxx b/sc/inc/progress.hxx
index d65c9b5..340c4c1 100644
--- a/sc/inc/progress.hxx
+++ b/sc/inc/progress.hxx
@@ -49,6 +49,7 @@ private:
static bool bAllowInterpretProgress;
static ScDocument* pInterpretDoc;
static bool bIdleWasEnabled;
+ bool bEnabled;
SfxProgress* pProgress;
@@ -143,6 +144,9 @@ public:
return pProgress->GetState();
return 0;
}
+ bool Enabled() const { return bEnabled; }
+ void Disable() { bEnabled = false; }
+ void Enable() { bEnabled = true; }
};
#endif
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index eca99eb..566c139 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -43,6 +43,7 @@
#include "formulagroup.hxx"
#include "listenercontext.hxx"
#include "mtvcellfunc.hxx"
+#include "progress.hxx"
#include "scmatrix.hxx"
#include <rowheightcontext.hxx>
@@ -2306,10 +2307,23 @@ bool appendToBlock(
sc::formula_block::iterator itData, itDataEnd;
getBlockIterators<sc::formula_block>(it, nLenRemain, itData, itDataEnd);
+ /* tdf#91416 setting progress in triggers a resize of the window
+ and so ScTabView::DoResize and an InterpretVisible and
+ InterpretDirtyCells which resets the mpFormulaGroupCxt that
+ the current rCxt points to, which is bad, so disable progress
+ during GetResult
+ */
+ ScProgress *pProgress = ScProgress::GetInterpretProgress();
+ bool bTempDisableProgress = pProgress && pProgress->Enabled();
+ if (bTempDisableProgress)
+ pProgress->Disable();
+
for (; itData != itDataEnd; ++itData, ++nPos)
{
ScFormulaCell& rFC = **itData;
+
sc::FormulaResultValue aRes = rFC.GetResult();
+
if (aRes.meType == sc::FormulaResultValue::Invalid || aRes.mnError)
{
if (aRes.mnError == ScErrorCodes::errCircularReference)
@@ -2332,6 +2346,9 @@ bool appendToBlock(
(*rColArray.mpNumArray)[nPos] = aRes.mfValue;
}
}
+
+ if (bTempDisableProgress)
+ pProgress->Enable();
}
break;
case sc::element_type_empty:
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 3e8e160..33499ba 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1931,8 +1931,12 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
}
// Reschedule slows the whole thing down considerably, thus only execute on percent change
- ScProgress::GetInterpretProgress()->SetStateCountDownOnPercent(
- pDocument->GetFormulaCodeInTree()/MIN_NO_CODES_PER_PROGRESS_UPDATE );
+ ScProgress *pProgress = ScProgress::GetInterpretProgress();
+ if (pProgress && pProgress->Enabled())
+ {
+ pProgress->SetStateCountDownOnPercent(
+ pDocument->GetFormulaCodeInTree()/MIN_NO_CODES_PER_PROGRESS_UPDATE );
+ }
switch (p->GetVolatileType())
{
diff --git a/sc/source/core/tool/progress.cxx b/sc/source/core/tool/progress.cxx
index ed5dcdc..e533986 100644
--- a/sc/source/core/tool/progress.cxx
+++ b/sc/source/core/tool/progress.cxx
@@ -70,8 +70,9 @@ static bool lcl_HasControllersLocked( SfxObjectShell& rObjSh )
return false;
}
-ScProgress::ScProgress( SfxObjectShell* pObjSh, const OUString& rText,
- sal_uLong nRange, bool bAllDocs, bool bWait )
+ScProgress::ScProgress(SfxObjectShell* pObjSh, const OUString& rText,
+ sal_uLong nRange, bool bAllDocs, bool bWait)
+ : bEnabled(true)
{
if ( pGlobalProgress || SfxProgress::GetActiveProgress( NULL ) )
@@ -114,9 +115,11 @@ ScProgress::ScProgress( SfxObjectShell* pObjSh, const OUString& rText,
}
}
-ScProgress::ScProgress() :
- pProgress( NULL )
-{ // DummyInterpret
+ScProgress::ScProgress()
+ : bEnabled(true)
+ , pProgress(NULL)
+{
+ // DummyInterpret
}
ScProgress::~ScProgress()
More information about the Libreoffice-commits
mailing list