[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 3 commits - cppu/source sc/inc sc/source solenv/gbuild
Michael Stahl
mst at kemper.freedesktop.org
Thu Jan 19 10:07:50 PST 2012
cppu/source/threadpool/thread.cxx | 25 ++
cppu/source/threadpool/thread.hxx | 2
sc/inc/global.hxx | 1
sc/source/core/data/global.cxx | 5
sc/source/core/data/table4.cxx | 232 +++++++++++++--------------
sc/source/ui/docshell/docfunc.cxx | 4
sc/source/ui/miscdlgs/scuiautofmt.cxx | 4
sc/source/ui/unoobj/afmtuno.cxx | 88 ++++------
sc/source/ui/unoobj/cellsuno.cxx | 4
sc/source/ui/view/cellsh3.cxx | 4
solenv/gbuild/platform/unxgcc_gdbforjunit.sh | 2
11 files changed, 190 insertions(+), 181 deletions(-)
New commits:
commit e2dda69cfe9925e6f5d2bc922febb53a0f69c50f
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Dec 16 13:56:32 2011 +0100
Report backtraces for all threads.
(cherry picked from commit 54a918bbfba47734d414832755e35434da103ed5)
Signed-off-by: Michael Stahl <mstahl at redhat.com>
diff --git a/solenv/gbuild/platform/unxgcc_gdbforjunit.sh b/solenv/gbuild/platform/unxgcc_gdbforjunit.sh
index 730d2e9..0341e7b 100755
--- a/solenv/gbuild/platform/unxgcc_gdbforjunit.sh
+++ b/solenv/gbuild/platform/unxgcc_gdbforjunit.sh
@@ -44,7 +44,7 @@ then
echo "Found a core dump at ${COREFILE}"
echo "Stacktrace:"
GDBCOMMANDFILE=`mktemp`
- echo "bt" > ${GDBCOMMANDFILE}
+ echo "thread apply all bt" > ${GDBCOMMANDFILE}
gdb -x $GDBCOMMANDFILE --batch ${OFFICEFILE}.bin ${COREFILE}
rm ${GDBCOMMANDFILE}
echo
commit c77a382e27d6ecabd98fa4788b4a372008fe7dbf
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Jan 11 09:26:41 2012 +0100
ScGlobal::GetAutoFormat not always required to create fresh instance.
...at least in ~ScAutoFormatObj it appears unnecessary and can lead to
crashes during Desktop::DeregisterServices (when ScGlobal::ppRscString
is already null and ScAutoFormat ctor calls ScGlobal::GetRscString).
Therefore split GetAutoFormat in two, GetOrCreateAutoFormat for cases
that probably need a non-null return and GetAutoFormat for those that
are OK with a null return.
(cherry picked from commit 0e4b36269097f8865bdbc1b9d299a2776ae0cc06)
Signed-off-by: Michael Stahl <mstahl at redhat.com>
Signed-off-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index a810400..ac10094 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -562,6 +562,7 @@ public:
SC_DLLPUBLIC static const SvxSearchItem& GetSearchItem();
SC_DLLPUBLIC static void SetSearchItem( const SvxSearchItem& rNew );
SC_DLLPUBLIC static ScAutoFormat* GetAutoFormat();
+ SC_DLLPUBLIC static ScAutoFormat* GetOrCreateAutoFormat();
static void ClearAutoFormat(); //BugId 54209
static FuncCollection* GetFuncCollection();
SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection();
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 6de3782..c43a853 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -299,6 +299,11 @@ void ScGlobal::ClearAutoFormat()
ScAutoFormat* ScGlobal::GetAutoFormat()
{
+ return pAutoFormat;
+}
+
+ScAutoFormat* ScGlobal::GetOrCreateAutoFormat()
+{
if ( !pAutoFormat )
{
pAutoFormat = new ScAutoFormat;
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 9b38214..bc99c5c 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1592,14 +1592,10 @@ void ScTable::Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
void ScTable::AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
const ScPatternAttr& rAttr, sal_uInt16 nFormatNo)
{
- ScAutoFormat* pAutoFormat = ScGlobal::GetAutoFormat();
- if (pAutoFormat)
+ ScAutoFormatData* pData = (*ScGlobal::GetOrCreateAutoFormat())[nFormatNo];
+ if (pData)
{
- ScAutoFormatData* pData = (*pAutoFormat)[nFormatNo];
- if (pData)
- {
- ApplyPatternArea(nStartCol, nStartRow, nEndCol, nEndRow, rAttr);
- }
+ ApplyPatternArea(nStartCol, nStartRow, nEndCol, nEndRow, rAttr);
}
}
@@ -1608,140 +1604,136 @@ void ScTable::AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW
{
if (ValidColRow(nStartCol, nStartRow) && ValidColRow(nEndCol, nEndRow))
{
- ScAutoFormat* pAutoFormat = ScGlobal::GetAutoFormat();
- if (pAutoFormat)
+ ScAutoFormatData* pData = (*ScGlobal::GetOrCreateAutoFormat())[nFormatNo];
+ if (pData)
{
- ScAutoFormatData* pData = (*pAutoFormat)[nFormatNo];
- if (pData)
+ ScPatternAttr* pPatternAttrs[16];
+ for (sal_uInt8 i = 0; i < 16; ++i)
+ {
+ pPatternAttrs[i] = new ScPatternAttr(pDocument->GetPool());
+ pData->FillToItemSet(i, pPatternAttrs[i]->GetItemSet(), *pDocument);
+ }
+
+ SCCOL nCol = nStartCol;
+ SCROW nRow = nStartRow;
+ sal_uInt16 nIndex = 0;
+ // Linke obere Ecke
+ AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
+ // Linke Spalte
+ if (pData->IsEqualData(4, 8))
+ AutoFormatArea(nStartCol, nStartRow + 1, nStartCol, nEndRow - 1, *pPatternAttrs[4], nFormatNo);
+ else
{
- ScPatternAttr* pPatternAttrs[16];
- for (sal_uInt8 i = 0; i < 16; ++i)
+ nIndex = 4;
+ for (nRow = nStartRow + 1; nRow < nEndRow; nRow++)
{
- pPatternAttrs[i] = new ScPatternAttr(pDocument->GetPool());
- pData->FillToItemSet(i, pPatternAttrs[i]->GetItemSet(), *pDocument);
+ AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
+ if (nIndex == 4)
+ nIndex = 8;
+ else
+ nIndex = 4;
}
-
- SCCOL nCol = nStartCol;
- SCROW nRow = nStartRow;
- sal_uInt16 nIndex = 0;
- // Linke obere Ecke
- AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
- // Linke Spalte
- if (pData->IsEqualData(4, 8))
- AutoFormatArea(nStartCol, nStartRow + 1, nStartCol, nEndRow - 1, *pPatternAttrs[4], nFormatNo);
- else
+ }
+ // Linke untere Ecke
+ nRow = nEndRow;
+ nIndex = 12;
+ AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
+ // Rechte obere Ecke
+ nCol = nEndCol;
+ nRow = nStartRow;
+ nIndex = 3;
+ AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
+ // Rechte Spalte
+ if (pData->IsEqualData(7, 11))
+ AutoFormatArea(nEndCol, nStartRow + 1, nEndCol, nEndRow - 1, *pPatternAttrs[7], nFormatNo);
+ else
+ {
+ nIndex = 7;
+ for (nRow = nStartRow + 1; nRow < nEndRow; nRow++)
{
- nIndex = 4;
- for (nRow = nStartRow + 1; nRow < nEndRow; nRow++)
- {
- AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
- if (nIndex == 4)
- nIndex = 8;
- else
- nIndex = 4;
- }
+ AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
+ if (nIndex == 7)
+ nIndex = 11;
+ else
+ nIndex = 7;
}
- // Linke untere Ecke
- nRow = nEndRow;
- nIndex = 12;
+ }
+ // Rechte untere Ecke
+ nRow = nEndRow;
+ nIndex = 15;
+ AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
+ nRow = nStartRow;
+ nIndex = 1;
+ for (nCol = nStartCol + 1; nCol < nEndCol; nCol++)
+ {
AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
- // Rechte obere Ecke
- nCol = nEndCol;
- nRow = nStartRow;
- nIndex = 3;
+ if (nIndex == 1)
+ nIndex = 2;
+ else
+ nIndex = 1;
+ }
+ // Untere Zeile
+ nRow = nEndRow;
+ nIndex = 13;
+ for (nCol = nStartCol + 1; nCol < nEndCol; nCol++)
+ {
AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
- // Rechte Spalte
- if (pData->IsEqualData(7, 11))
- AutoFormatArea(nEndCol, nStartRow + 1, nEndCol, nEndRow - 1, *pPatternAttrs[7], nFormatNo);
+ if (nIndex == 13)
+ nIndex = 14;
else
+ nIndex = 13;
+ }
+ // Boddy
+ if ((pData->IsEqualData(5, 6)) && (pData->IsEqualData(9, 10)) && (pData->IsEqualData(5, 9)))
+ AutoFormatArea(nStartCol + 1, nStartRow + 1, nEndCol-1, nEndRow - 1, *pPatternAttrs[5], nFormatNo);
+ else
+ {
+ if ((pData->IsEqualData(5, 9)) && (pData->IsEqualData(6, 10)))
{
- nIndex = 7;
- for (nRow = nStartRow + 1; nRow < nEndRow; nRow++)
+ nIndex = 5;
+ for (nCol = nStartCol + 1; nCol < nEndCol; nCol++)
{
- AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
- if (nIndex == 7)
- nIndex = 11;
+ AutoFormatArea(nCol, nStartRow + 1, nCol, nEndRow - 1, *pPatternAttrs[nIndex], nFormatNo);
+ if (nIndex == 5)
+ nIndex = 6;
else
- nIndex = 7;
+ nIndex = 5;
}
}
- // Rechte untere Ecke
- nRow = nEndRow;
- nIndex = 15;
- AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
- nRow = nStartRow;
- nIndex = 1;
- for (nCol = nStartCol + 1; nCol < nEndCol; nCol++)
- {
- AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
- if (nIndex == 1)
- nIndex = 2;
- else
- nIndex = 1;
- }
- // Untere Zeile
- nRow = nEndRow;
- nIndex = 13;
- for (nCol = nStartCol + 1; nCol < nEndCol; nCol++)
- {
- AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
- if (nIndex == 13)
- nIndex = 14;
- else
- nIndex = 13;
- }
- // Boddy
- if ((pData->IsEqualData(5, 6)) && (pData->IsEqualData(9, 10)) && (pData->IsEqualData(5, 9)))
- AutoFormatArea(nStartCol + 1, nStartRow + 1, nEndCol-1, nEndRow - 1, *pPatternAttrs[5], nFormatNo);
else
{
- if ((pData->IsEqualData(5, 9)) && (pData->IsEqualData(6, 10)))
+ nIndex = 5;
+ for (nCol = nStartCol + 1; nCol < nEndCol; nCol++)
{
- nIndex = 5;
- for (nCol = nStartCol + 1; nCol < nEndCol; nCol++)
+ for (nRow = nStartRow + 1; nRow < nEndRow; nRow++)
{
- AutoFormatArea(nCol, nStartRow + 1, nCol, nEndRow - 1, *pPatternAttrs[nIndex], nFormatNo);
- if (nIndex == 5)
- nIndex = 6;
- else
- nIndex = 5;
- }
- }
- else
- {
- nIndex = 5;
- for (nCol = nStartCol + 1; nCol < nEndCol; nCol++)
- {
- for (nRow = nStartRow + 1; nRow < nEndRow; nRow++)
+ AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
+ if ((nIndex == 5) || (nIndex == 9))
{
- AutoFormatArea(nCol, nRow, nCol, nRow, *pPatternAttrs[nIndex], nFormatNo);
- if ((nIndex == 5) || (nIndex == 9))
- {
- if (nIndex == 5)
- nIndex = 9;
- else
- nIndex = 5;
- }
+ if (nIndex == 5)
+ nIndex = 9;
else
- {
- if (nIndex == 6)
- nIndex = 10;
- else
- nIndex = 6;
- }
- } // for nRow
- if ((nIndex == 5) || (nIndex == 9))
- nIndex = 6;
+ nIndex = 5;
+ }
else
- nIndex = 5;
- } // for nCol
- } // if not equal Column
- } // if not all equal
-
- for (sal_uInt8 j = 0; j < 16; ++j)
- delete pPatternAttrs[j];
- } // if AutoFormatData != NULL
- } // if AutoFormat != NULL
+ {
+ if (nIndex == 6)
+ nIndex = 10;
+ else
+ nIndex = 6;
+ }
+ } // for nRow
+ if ((nIndex == 5) || (nIndex == 9))
+ nIndex = 6;
+ else
+ nIndex = 5;
+ } // for nCol
+ } // if not equal Column
+ } // if not all equal
+
+ for (sal_uInt8 j = 0; j < 16; ++j)
+ delete pPatternAttrs[j];
+ } // if AutoFormatData != NULL
} // if ValidColRow
}
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 598c1ea..fd62c60 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -3693,9 +3693,9 @@ sal_Bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMar
aMark.SelectTable( nTab, sal_True );
}
- ScAutoFormat* pAutoFormat = ScGlobal::GetAutoFormat();
+ ScAutoFormat* pAutoFormat = ScGlobal::GetOrCreateAutoFormat();
ScEditableTester aTester( pDoc, nStartCol,nStartRow, nEndCol,nEndRow, aMark );
- if ( pAutoFormat && nFormatNo < pAutoFormat->GetCount() && aTester.IsEditable() )
+ if ( nFormatNo < pAutoFormat->GetCount() && aTester.IsEditable() )
{
WaitObject aWait( rDocShell.GetActiveDialogParent() );
diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx
index d51b420..9466a4b 100644
--- a/sc/source/ui/miscdlgs/scuiautofmt.cxx
+++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx
@@ -194,7 +194,7 @@ IMPL_LINK( ScAutoFormatDlg, CloseHdl, PushButton *, pBtn )
if ( pBtn == &aBtnOk || pBtn == &aBtnCancel )
{
if ( bCoreDataChanged )
- ScGlobal::GetAutoFormat()->Save();
+ ScGlobal::GetOrCreateAutoFormat()->Save();
EndDialog( (pBtn == &aBtnOk) ? RET_OK : RET_CANCEL );
}
@@ -206,7 +206,7 @@ IMPL_LINK( ScAutoFormatDlg, CloseHdl, PushButton *, pBtn )
IMPL_LINK_INLINE_START( ScAutoFormatDlg, DblClkHdl, void *, EMPTYARG )
{
if ( bCoreDataChanged )
- ScGlobal::GetAutoFormat()->Save();
+ ScGlobal::GetOrCreateAutoFormat()->Save();
EndDialog( RET_OK );
return 0;
diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx
index e8f9493..f072725 100644
--- a/sc/source/ui/unoobj/afmtuno.cxx
+++ b/sc/source/ui/unoobj/afmtuno.cxx
@@ -221,8 +221,7 @@ uno::Sequence<rtl::OUString> ScAutoFormatsObj::getSupportedServiceNames_Static()
ScAutoFormatObj* ScAutoFormatsObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
{
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
- if (pFormats && nIndex < pFormats->GetCount())
+ if (nIndex < ScGlobal::GetOrCreateAutoFormat()->GetCount())
return new ScAutoFormatObj(nIndex);
return NULL; // falscher Index
@@ -230,14 +229,11 @@ ScAutoFormatObj* ScAutoFormatsObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
ScAutoFormatObj* ScAutoFormatsObj::GetObjectByName_Impl(const rtl::OUString& aName)
{
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
- if (pFormats)
- {
- String aString(aName);
- sal_uInt16 nIndex;
- if (lcl_FindAutoFormatIndex( *pFormats, aString, nIndex ))
- return GetObjectByIndex_Impl(nIndex);
- }
+ String aString(aName);
+ sal_uInt16 nIndex;
+ if (lcl_FindAutoFormatIndex(
+ *ScGlobal::GetOrCreateAutoFormat(), aString, nIndex ))
+ return GetObjectByIndex_Impl(nIndex);
return NULL;
}
@@ -257,10 +253,10 @@ void SAL_CALL ScAutoFormatsObj::insertByName( const rtl::OUString& aName, const
if ( pFormatObj && !pFormatObj->IsInserted() ) // noch nicht eingefuegt?
{
String aNameStr(aName);
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
+ ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
sal_uInt16 nDummy;
- if (pFormats && !lcl_FindAutoFormatIndex( *pFormats, aNameStr, nDummy ))
+ if (!lcl_FindAutoFormatIndex( *pFormats, aNameStr, nDummy ))
{
ScAutoFormatData* pNew = new ScAutoFormatData();
pNew->SetName( aNameStr );
@@ -314,10 +310,10 @@ void SAL_CALL ScAutoFormatsObj::removeByName( const rtl::OUString& aName )
{
SolarMutexGuard aGuard;
String aNameStr(aName);
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
+ ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
sal_uInt16 nIndex;
- if (pFormats && lcl_FindAutoFormatIndex( *pFormats, aNameStr, nIndex ))
+ if (lcl_FindAutoFormatIndex( *pFormats, aNameStr, nIndex ))
{
pFormats->AtFree( nIndex );
@@ -344,11 +340,7 @@ uno::Reference<container::XEnumeration> SAL_CALL ScAutoFormatsObj::createEnumera
sal_Int32 SAL_CALL ScAutoFormatsObj::getCount() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
- if (pFormats)
- return pFormats->GetCount();
-
- return 0;
+ return ScGlobal::GetOrCreateAutoFormat()->GetCount();
}
uno::Any SAL_CALL ScAutoFormatsObj::getByIndex( sal_Int32 nIndex )
@@ -391,35 +383,27 @@ uno::Sequence<rtl::OUString> SAL_CALL ScAutoFormatsObj::getElementNames()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
- if (pFormats)
+ ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
+ String aName;
+ sal_uInt16 nCount = pFormats->GetCount();
+ uno::Sequence<rtl::OUString> aSeq(nCount);
+ rtl::OUString* pAry = aSeq.getArray();
+ for (sal_uInt16 i=0; i<nCount; i++)
{
- String aName;
- sal_uInt16 nCount = pFormats->GetCount();
- uno::Sequence<rtl::OUString> aSeq(nCount);
- rtl::OUString* pAry = aSeq.getArray();
- for (sal_uInt16 i=0; i<nCount; i++)
- {
- (*pFormats)[i]->GetName(aName);
- pAry[i] = aName;
- }
- return aSeq;
+ (*pFormats)[i]->GetName(aName);
+ pAry[i] = aName;
}
- return uno::Sequence<rtl::OUString>(0);
+ return aSeq;
}
sal_Bool SAL_CALL ScAutoFormatsObj::hasByName( const rtl::OUString& aName )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
- if (pFormats)
- {
- String aString(aName);
- sal_uInt16 nDummy;
- return lcl_FindAutoFormatIndex( *pFormats, aString, nDummy );
- }
- return false;
+ String aString(aName);
+ sal_uInt16 nDummy;
+ return lcl_FindAutoFormatIndex(
+ *ScGlobal::GetOrCreateAutoFormat(), aString, nDummy );
}
//------------------------------------------------------------------------
@@ -553,8 +537,8 @@ sal_Bool SAL_CALL ScAutoFormatObj::hasElements() throw(uno::RuntimeException)
rtl::OUString SAL_CALL ScAutoFormatObj::getName() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
- if (pFormats && IsInserted() && nFormatIndex < pFormats->GetCount())
+ ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
+ if (IsInserted() && nFormatIndex < pFormats->GetCount())
{
String aName;
(*pFormats)[nFormatIndex]->GetName(aName);
@@ -568,10 +552,10 @@ void SAL_CALL ScAutoFormatObj::setName( const rtl::OUString& aNewName )
{
SolarMutexGuard aGuard;
String aNewString(aNewName);
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
+ ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
sal_uInt16 nDummy;
- if (pFormats && IsInserted() && nFormatIndex < pFormats->GetCount() &&
+ if (IsInserted() && nFormatIndex < pFormats->GetCount() &&
!lcl_FindAutoFormatIndex( *pFormats, aNewString, nDummy ))
{
ScAutoFormatData* pData = (*pFormats)[nFormatIndex];
@@ -619,8 +603,8 @@ void SAL_CALL ScAutoFormatObj::setPropertyValue(
uno::RuntimeException)
{
SolarMutexGuard aGuard;
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
- if (pFormats && IsInserted() && nFormatIndex < pFormats->GetCount())
+ ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
+ if (IsInserted() && nFormatIndex < pFormats->GetCount())
{
ScAutoFormatData* pData = (*pFormats)[nFormatIndex];
OSL_ENSURE(pData,"AutoFormat Daten nicht da");
@@ -654,8 +638,8 @@ uno::Any SAL_CALL ScAutoFormatObj::getPropertyValue( const rtl::OUString& aPrope
SolarMutexGuard aGuard;
uno::Any aAny;
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
- if (pFormats && IsInserted() && nFormatIndex < pFormats->GetCount())
+ ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
+ if (IsInserted() && nFormatIndex < pFormats->GetCount())
{
ScAutoFormatData* pData = (*pFormats)[nFormatIndex];
OSL_ENSURE(pData,"AutoFormat Daten nicht da");
@@ -724,11 +708,11 @@ void SAL_CALL ScAutoFormatFieldObj::setPropertyValue(
uno::RuntimeException)
{
SolarMutexGuard aGuard;
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
+ ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
const SfxItemPropertySimpleEntry* pEntry =
aPropSet.getPropertyMap()->getByName( aPropertyName );
- if ( pEntry && pEntry->nWID && pFormats && nFormatIndex < pFormats->GetCount() )
+ if ( pEntry && pEntry->nWID && nFormatIndex < pFormats->GetCount() )
{
ScAutoFormatData* pData = (*pFormats)[nFormatIndex];
@@ -814,11 +798,11 @@ uno::Any SAL_CALL ScAutoFormatFieldObj::getPropertyValue( const rtl::OUString& a
SolarMutexGuard aGuard;
uno::Any aVal;
- ScAutoFormat* pFormats = ScGlobal::GetAutoFormat();
+ ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat();
const SfxItemPropertySimpleEntry* pEntry =
aPropSet.getPropertyMap()->getByName( aPropertyName );
- if ( pEntry && pEntry->nWID && pFormats && nFormatIndex < pFormats->GetCount() )
+ if ( pEntry && pEntry->nWID && nFormatIndex < pFormats->GetCount() )
{
const ScAutoFormatData* pData = (*pFormats)[nFormatIndex];
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 6be0239..ca59caf 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -5500,10 +5500,10 @@ void SAL_CALL ScCellRangeObj::autoFormat( const rtl::OUString& aName )
throw(lang::IllegalArgumentException, uno::RuntimeException)
{
SolarMutexGuard aGuard;
- ScAutoFormat* pAutoFormat = ScGlobal::GetAutoFormat();
ScDocShell* pDocSh = GetDocShell();
- if ( pDocSh && pAutoFormat )
+ if ( pDocSh )
{
+ ScAutoFormat* pAutoFormat = ScGlobal::GetOrCreateAutoFormat();
String aNameString(aName);
sal_uInt16 nCount = pAutoFormat->GetCount();
sal_uInt16 nIndex;
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 19111c8..a9950c8 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -816,7 +816,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
if ( pReqArgs )
{
const SfxStringItem& rNameItem = (const SfxStringItem&)pReqArgs->Get( SID_AUTOFORMAT );
- ScAutoFormat* pFormat = ScGlobal::GetAutoFormat();
+ ScAutoFormat* pFormat = ScGlobal::GetOrCreateAutoFormat();
sal_uInt16 nIndex = pFormat->FindIndexPerName( rNameItem.GetValue() );
pTabViewShell->AutoFormat( nIndex );
@@ -831,7 +831,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
- AbstractScAutoFormatDlg* pDlg = pFact->CreateScAutoFormatDlg( pDlgParent, ScGlobal::GetAutoFormat(), pNewEntry,GetViewData()->GetDocument(), RID_SCDLG_AUTOFORMAT );
+ AbstractScAutoFormatDlg* pDlg = pFact->CreateScAutoFormatDlg( pDlgParent, ScGlobal::GetOrCreateAutoFormat(), pNewEntry,GetViewData()->GetDocument(), RID_SCDLG_AUTOFORMAT );
OSL_ENSURE(pDlg, "Dialog create fail!");
if ( pDlg->Execute() == RET_OK )
commit 880b66fe31296fce70ec2e2f8a9c2ce4092cee9d
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Dec 19 14:15:28 2011 +0100
Prevent creation of new ORequestThreads during shutdown.
(cherry picked from commit b68640c44ecdb1df59d704cc6c2bae8bb412d7d0)
Signed-off-by: Michael Stahl <mstahl at redhat.com>
Signed-off-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/cppu/source/threadpool/thread.cxx b/cppu/source/threadpool/thread.cxx
index 58aec56..cc22a45 100644
--- a/cppu/source/threadpool/thread.cxx
+++ b/cppu/source/threadpool/thread.cxx
@@ -30,12 +30,22 @@
#include <osl/diagnose.h>
#include <uno/threadpool.h>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
#include <rtl/instance.hxx>
+#include <rtl/ustring.h>
+#include <rtl/ustring.hxx>
#include "thread.hxx"
#include "jobqueue.hxx"
#include "threadpool.hxx"
+namespace {
+
+namespace css = com::sun::star;
+
+}
using namespace osl;
extern "C" {
@@ -53,6 +63,8 @@ void SAL_CALL cppu_requestThreadWorker( void *pVoid )
namespace cppu_threadpool {
// ----------------------------------------------------------------------------------
+ ThreadAdmin::ThreadAdmin(): m_disposed(false) {}
+
ThreadAdmin::~ThreadAdmin()
{
#if OSL_DEBUG_LEVEL > 1
@@ -66,6 +78,15 @@ namespace cppu_threadpool {
void ThreadAdmin::add( ORequestThread *p )
{
MutexGuard aGuard( m_mutex );
+ if( m_disposed )
+ {
+ throw css::lang::DisposedException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "cppu_threadpool::ORequestThread created after"
+ " cppu_threadpool::ThreadAdmin has been disposed")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
m_lst.push_back( p );
}
@@ -79,6 +100,10 @@ namespace cppu_threadpool {
void ThreadAdmin::join()
{
+ {
+ MutexGuard aGuard( m_mutex );
+ m_disposed = true;
+ }
ORequestThread *pCurrent;
do
{
diff --git a/cppu/source/threadpool/thread.hxx b/cppu/source/threadpool/thread.hxx
index bbef51e..a3ea45a 100644
--- a/cppu/source/threadpool/thread.hxx
+++ b/cppu/source/threadpool/thread.hxx
@@ -74,6 +74,7 @@ namespace cppu_threadpool {
class ThreadAdmin
{
public:
+ ThreadAdmin();
~ThreadAdmin ();
static ThreadAdminHolder &getInstance();
void add( ORequestThread * );
@@ -83,6 +84,7 @@ namespace cppu_threadpool {
private:
::osl::Mutex m_mutex;
::std::list< ORequestThread * > m_lst;
+ bool m_disposed;
};
} // end cppu_threadpool
More information about the Libreoffice-commits
mailing list