[openoffice.org/f14/master] Resolves: rhbz#666088 don't crash on clean up of search cache
Caolan McNamara
caolanm at fedoraproject.org
Thu Jan 6 17:16:17 UTC 2011
commit 27d3488f8e8c0946c764429ab4de9cd6276f3938
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jan 6 17:15:43 2011 +0000
Resolves: rhbz#666088 don't crash on clean up of search cache
...bz-666088-clean-up-search-cache-singleton.patch | 109 ++++++++++++++++++++
openoffice.org.spec | 7 +-
2 files changed, 115 insertions(+), 1 deletions(-)
---
diff --git a/0001-Resolves-rhbz-666088-clean-up-search-cache-singleton.patch b/0001-Resolves-rhbz-666088-clean-up-search-cache-singleton.patch
new file mode 100644
index 0000000..a07c8b9
--- /dev/null
+++ b/0001-Resolves-rhbz-666088-clean-up-search-cache-singleton.patch
@@ -0,0 +1,109 @@
+From b79c4f7daf165e4190b12a19382f4e5615b43163 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Thu, 6 Jan 2011 17:05:14 +0000
+Subject: [PATCH] Resolves: rhbz#666088 clean up search cache singleton in correct order
+
+---
+ unotools/inc/unotools/textsearch.hxx | 9 --------
+ unotools/source/i18n/textsearch.cxx | 37 +++++++++++++++++++++------------
+ 2 files changed, 23 insertions(+), 23 deletions(-)
+
+diff --git a/unotools/inc/unotools/textsearch.hxx b/unotools/inc/unotools/textsearch.hxx
+index 0aaa123..16ae82f 100644
+--- a/unotools/inc/unotools/textsearch.hxx
++++ b/unotools/inc/unotools/textsearch.hxx
+@@ -128,15 +128,6 @@ public:
+
+ class UNOTOOLS_DLLPUBLIC TextSearch
+ {
+- struct CachedTextSearch
+- {
+- ::osl::Mutex mutex;
+- ::com::sun::star::util::SearchOptions Options;
+- ::com::sun::star::uno::Reference< ::com::sun::star::util::XTextSearch > xTextSearch;
+- };
+-
+- static CachedTextSearch maCache;
+-
+ static ::com::sun::star::uno::Reference< ::com::sun::star::util::XTextSearch >
+ getXTextSearch( const ::com::sun::star::util::SearchOptions& rPara );
+
+diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx
+index 8f8f780..8085045 100644
+--- a/unotools/source/i18n/textsearch.cxx
++++ b/unotools/source/i18n/textsearch.cxx
+@@ -36,6 +36,7 @@
+ #include <unotools/charclass.hxx>
+ #include <comphelper/processfactory.hxx>
+ #include <unotools/textsearch.hxx>
++#include <rtl/instance.hxx>
+
+ using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::uno;
+@@ -86,13 +87,6 @@ SearchParam::SearchParam( const SearchParam& rParam )
+ nTransliterationFlags = rParam.nTransliterationFlags;
+ }
+
+-// Klasse zum Suchen eines Strings in einem Text. Es wird genau nach
+-// dem String gesucht.
+-// ( Die Unterscheidung der Gross/Klein-Schreibung kann mit einen Flag
+-// unterdrueckt werden )
+-
+-TextSearch::CachedTextSearch TextSearch::maCache;
+-
+ static bool lcl_Equals( const SearchOptions& rSO1, const SearchOptions& rSO2 )
+ {
+ return rSO1.algorithmType == rSO2.algorithmType &&
+@@ -108,27 +102,42 @@ static bool lcl_Equals( const SearchOptions& rSO1, const SearchOptions& rSO2 )
+ rSO1.transliterateFlags == rSO2.transliterateFlags;
+ }
+
++namespace
++{
++ struct CachedTextSearch
++ {
++ ::osl::Mutex mutex;
++ ::com::sun::star::util::SearchOptions Options;
++ ::com::sun::star::uno::Reference< ::com::sun::star::util::XTextSearch > xTextSearch;
++ };
++
++ struct theCachedTextSearch
++ : public rtl::Static< CachedTextSearch, theCachedTextSearch > {};
++}
++
+ Reference<XTextSearch> TextSearch::getXTextSearch( const SearchOptions& rPara )
+ {
+- osl::MutexGuard aGuard(maCache.mutex);
++ CachedTextSearch &rCache = theCachedTextSearch::get();
++
++ osl::MutexGuard aGuard(rCache.mutex);
+
+- if ( lcl_Equals(maCache.Options, rPara) )
+- return maCache.xTextSearch;
++ if ( lcl_Equals(rCache.Options, rPara) )
++ return rCache.xTextSearch;
+
+ try
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+- maCache.xTextSearch.set( xMSF->createInstance(
++ rCache.xTextSearch.set( xMSF->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.TextSearch" ) ) ), UNO_QUERY_THROW );
+- maCache.xTextSearch->setOptions( rPara );
+- maCache.Options = rPara;
++ rCache.xTextSearch->setOptions( rPara );
++ rCache.Options = rPara;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "TextSearch ctor: Exception caught!" );
+ }
+- return maCache.xTextSearch;
++ return rCache.xTextSearch;
+ }
+
+ TextSearch::TextSearch(const SearchParam & rParam, LanguageType eLang )
+--
+1.7.3.3
+
diff --git a/openoffice.org.spec b/openoffice.org.spec
index e857321..5307f87 100644
--- a/openoffice.org.spec
+++ b/openoffice.org.spec
@@ -1,6 +1,6 @@
%define oootag OOO330
%define ooomilestone 18
-%define rh_rpm_release 3
+%define rh_rpm_release 4
# rhbz#465664 jar-repacking breaks help by reordering META-INF/MANIFEST.MF
%define __jar_repack %{nil}
@@ -153,6 +153,7 @@ Patch69: 0001-Resoves-rhbz-663857-font-color-missing-C-FAQ-10.3-do.patch
Patch70: workspace.jl155.patch
Patch71: 0001-Avoid-double-paste-when-pasting-text-into-cell-comme.patch
Patch72: 0001-Resolves-rhbz-660342-Undo-Redo-crash-with-postits.patch
+Patch73: 0001-Resolves-rhbz-666088-clean-up-search-cache-singleton.patch
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%define instdir %{_libdir}
@@ -1722,6 +1723,7 @@ cp -p %{SOURCE5} external/unowinreg/unowinreg.dll
%patch70 -p1 -b .workspace.jl155.patch
%patch71 -p1 -b .Avoid-double-paste-when-pasting-text-into-cell-comme.patch
%patch72 -p1 -b .rhbz-660342-Undo-Redo-crash-with-postits.patch
+%patch73 -p1 -b .rhbz-666088-clean-up-search-cache-singleton.patch
touch scripting/source/pyprov/delzip
touch scripting/util/provider/beanshell/delzip
touch scripting/util/provider/javascript/delzip
@@ -3918,6 +3920,9 @@ unopkg remove --shared org.openoffice.legacy.ScriptProviderForPython.zip > /dev/
%endif
%changelog
+* Thu Jan 06 2010 Caolán McNamara <caolanm at redhat.com>- 1:3.3.0-18.4-UNBUILT
+- Resolves: rhbz#666088 don't crash on clean up of search cache
+
* Wed Dec 22 2010 Caolán McNamara <caolanm at redhat.com>- 1:3.3.0-18.3
- Resolves: rhbz#663724 fdo32572-sc-dont-double-paste.patch
- Resolves: rhbz#660342 Undo/Redo crash with postits
More information about the scm-commits
mailing list