From 84b8ee0fa359a75599d0dae9390e80d22dff91b9 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 24 Oct 2013 16:01:30 +0200 Subject: [PATCH] Resolves: fdo#67725 unoidl::AggregatingCursor must wrap modules for aggregation --- ...-AggregatingCursor-must-wrap-modules.patch | 172 ++++++++++++++++++ libreoffice.spec | 7 +- 2 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 0001-fdo-67725-unoidl-AggregatingCursor-must-wrap-modules.patch diff --git a/0001-fdo-67725-unoidl-AggregatingCursor-must-wrap-modules.patch b/0001-fdo-67725-unoidl-AggregatingCursor-must-wrap-modules.patch new file mode 100644 index 0000000..8a840ea --- /dev/null +++ b/0001-fdo-67725-unoidl-AggregatingCursor-must-wrap-modules.patch @@ -0,0 +1,172 @@ +From f450c132e6a65e1d11f20595bb0bfbf786e1dc2d Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Thu, 24 Oct 2013 09:48:13 +0200 +Subject: [PATCH] fdo#67725 unoidl::AggregatingCursor must wrap modules for + aggregation, too + +Otherwise cppuhelper::TypeManager::createTypeDescriptionEnumeration, sitting on +top such an AggregatingCursor, will miss any entities from provider P' in module +M if any previous provider P contains the same module M. + +That happened when climaker generates cli_oootypes.dll, where the enumeration +missed everything from offapi in top-level module "com" because it had already +seen udkapi's "com", and only reported the handful of entities under offapi's +other top-level module "org" (which does not appear in udkapi). + +Change-Id: If538391bde22bcc346417b5988cf12023f0d4172 +(cherry picked from commit bdd55e28fc7788c2968daaf87b782f8e6189ee2d) +--- + unoidl/source/unoidl.cxx | 112 +++++++++++++++++++++++++++++++++-------------- + 1 file changed, 78 insertions(+), 34 deletions(-) + +diff --git a/unoidl/source/unoidl.cxx b/unoidl/source/unoidl.cxx +index a9939e4..c55e02b 100644 +--- a/unoidl/source/unoidl.cxx ++++ b/unoidl/source/unoidl.cxx +@@ -23,41 +23,101 @@ namespace unoidl { + + namespace { + ++class AggregatingModule: public ModuleEntity { ++public: ++ AggregatingModule( ++ std::vector< rtl::Reference< Provider > > const & providers, ++ OUString const & name): ++ providers_(providers), name_(name) ++ {} ++ ++private: ++ virtual ~AggregatingModule() throw () {} ++ ++ virtual std::vector< OUString > getMemberNames() const; ++ ++ virtual rtl::Reference< MapCursor > createCursor() const; ++ ++ std::vector< rtl::Reference< Provider > > providers_; ++ OUString name_; ++}; ++ ++std::vector< OUString > AggregatingModule::getMemberNames() const { ++ std::set< OUString > names; ++ for (std::vector< rtl::Reference< Provider > >::const_iterator i( ++ providers_.begin()); ++ i != providers_.end(); ++i) ++ { ++ rtl::Reference< Entity > ent((*i)->findEntity(name_)); ++ if (ent.is() && ent->getSort() == Entity::SORT_MODULE) { ++ std::vector< OUString > ns( ++ static_cast< ModuleEntity * >(ent.get())->getMemberNames()); ++ names.insert(ns.begin(), ns.end()); ++ } ++ } ++ return std::vector< OUString >(names.begin(), names.end()); ++} ++ + class AggregatingCursor: public MapCursor { + public: + AggregatingCursor( +- std::vector< rtl::Reference< MapCursor > > const & cursors): +- cursors_(cursors), iterator_(cursors_.begin()) +- {} ++ std::vector< rtl::Reference< Provider > > const & providers, ++ OUString const & name): ++ providers_(providers), name_(name), iterator_(providers_.begin()) ++ { findCursor(); } + + private: + virtual ~AggregatingCursor() throw () {} + +- virtual rtl::Reference< Entity > getNext(rtl::OUString * name); ++ virtual rtl::Reference< Entity > getNext(OUString * name); + +- std::vector< rtl::Reference< MapCursor > > cursors_; +- std::vector< rtl::Reference< MapCursor > >::iterator iterator_; +- std::set< rtl::OUString > seenMembers; ++ void findCursor(); ++ ++ std::vector< rtl::Reference< Provider > > providers_; ++ OUString name_; ++ std::vector< rtl::Reference< Provider > >::iterator iterator_; ++ rtl::Reference< MapCursor > cursor_; ++ std::set< OUString > seen_; + }; + +-rtl::Reference< Entity > AggregatingCursor::getNext(rtl::OUString * name) { +- for (;;) { +- if (iterator_ == cursors_.end()) { +- return rtl::Reference< Entity >(); +- } +- rtl::OUString n; +- rtl::Reference< Entity > ent((*iterator_)->getNext(&n)); ++rtl::Reference< Entity > AggregatingCursor::getNext(OUString * name) { ++ while (cursor_.is()) { ++ OUString n; ++ rtl::Reference< Entity > ent(cursor_->getNext(&n)); + if (ent.is()) { +- if (seenMembers.insert(n).second) { ++ if (seen_.insert(n).second) { + if (name != 0) { + *name = n; + } +- return ent; ++ return ent->getSort() == Entity::SORT_MODULE ++ ? new AggregatingModule( ++ providers_, (name_.isEmpty() ? name_ : name_ + ".") + n) ++ : ent; + } + } else { +- ++iterator_; ++ cursor_.clear(); ++ findCursor(); + } + } ++ return rtl::Reference< Entity >(); ++} ++ ++void AggregatingCursor::findCursor() { ++ for (; !cursor_.is() && iterator_ != providers_.end(); ++iterator_) { ++ if (name_.isEmpty()) { ++ cursor_ = (*iterator_)->createRootCursor(); ++ } else { ++ rtl::Reference< Entity > ent((*iterator_)->findEntity(name_)); ++ if (ent.is() && ent->getSort() == Entity::SORT_MODULE) { ++ cursor_ = static_cast< ModuleEntity * >(ent.get())-> ++ createCursor(); ++ } ++ } ++ } ++} ++ ++rtl::Reference< MapCursor > AggregatingModule::createCursor() const { ++ return new AggregatingCursor(providers_, name_); + } + + } +@@ -139,23 +199,7 @@ rtl::Reference< Entity > Manager::findEntity(rtl::OUString const & name) const { + rtl::Reference< MapCursor > Manager::createCursor(rtl::OUString const & name) + const + { +- std::vector< rtl::Reference< MapCursor > > curs; +- for (std::vector< rtl::Reference< Provider > >::const_iterator i( +- providers_.begin()); +- i != providers_.end(); ++i) +- { +- if (name.isEmpty()) { +- curs.push_back((*i)->createRootCursor()); +- } else { +- rtl::Reference< Entity > ent((*i)->findEntity(name)); +- if (ent.is() && ent->getSort() == Entity::SORT_MODULE) { +- curs.push_back( +- static_cast< ModuleEntity * >(ent.get())->createCursor()); +- } +- } +- } +- return curs.empty() +- ? rtl::Reference< MapCursor >() : new AggregatingCursor(curs); ++ return new AggregatingCursor(providers_, name); + } + + Manager::~Manager() throw () {} +-- +1.8.3.1 + diff --git a/libreoffice.spec b/libreoffice.spec index 89659e0..23758a8 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -43,7 +43,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.2 -Release: 1%{?libo_prerelease}%{?dist} +Release: 2%{?libo_prerelease}%{?dist} License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 Group: Applications/Productivity URL: http://www.libreoffice.org/default/ @@ -263,6 +263,7 @@ Patch22: 0001-fdo-70201-sw-eliminate-no-extent-RSID-only-AUTOFMT-h.patch Patch23: 0001-WaE-Wstrict-overflow-assuming-signed-overflow-does-n.patch Patch24: 0001-Related-rhbz-1020712-wrong-default-font-shown-in-edi.patch Patch25: 0001-Related-rhbz-919070-display-1-means-span-all-display.patch +Patch26: 0001-fdo-67725-unoidl-AggregatingCursor-must-wrap-modules.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice @@ -1020,6 +1021,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc %patch23 -p1 -b .WaE-Wstrict-overflow-assuming-signed-overflow-does-n.patch %patch24 -p1 -b .rhbz-1020712-wrong-default-font-shown-in-edi.patch %patch25 -p1 -b .rhbz-919070-display-1-means-span-all-display.patch +%patch26 -p1 -b .fdo-67725-unoidl-AggregatingCursor-must-wrap-modules.patch # TODO: check this # these are horribly incomplete--empty translations and copied english @@ -2111,6 +2113,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %endif %changelog +* Thu Oct 24 2013 Stephan Bergmann - 1:4.1.3.2-2 +- Resolves: fdo#67725 unoidl::AggregatingCursor must wrap modules for aggregation + * Wed Oct 23 2013 David Tardon - 1:4.1.3.2-1 - 4.1.3 rc2 - Resolves: rhbz#1022094 libreoffice-4.1.3.1-1 was built without