https://bugs.documentfoundation.org/show_bug.cgi?id=160094
Michael Weghorn <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Status|NEW |ASSIGNED Assignee|[email protected] |[email protected] |desktop.org | --- Comment #9 from Michael Weghorn <[email protected]> --- (In reply to Julien Nabet from comment #3) > I tried on a non debug build and didn't reproduce the pb quite weirdly. I suspect that's because `--enable-dbgutil` on Linux enables `-D_GLIBCXX_DEBUG`, i.e. extra bounds checks for containers within libstdc++ (the C++ library implementation) which detect the invalid iterator and abort. But in a non-debug build, that is just "ignored" (which may result in other unexpected behavior, of course...). (In reply to Julien Nabet from comment #6) > There are 2 main parts which rely on RTL/LTR layout in > sd/source/console/PresenterToolBar.cxx: > 1) in PresenterToolBar::Layout line 747 > 2) in PresenterToolBar::LayoutPart line 846 > > I thought that instead of 2 different treatments, perhaps we may just use a > reversed vector. > "maElementContainer" is defined as "ElementContainer" which is a typedef of > ::std::vector<SharedElementContainerPart>. > > For 1) it does the trick. > > For 2) we do "for (auto& rxElement : *rpPart)" > rpPart is "SharedElementContainerPart" which is defined as > "std::shared_ptr<ElementContainerPart>" > so *rpPart is "ElementContainerPart". > This last one is defined as "class PresenterToolBar::ElementContainerPart > : public ::std::vector<rtl::Reference<Element> >" The series up to https://gerrit.libreoffice.org/c/core/+/185383 is my take at this which also does some deduplication. More cleanup/simplification may be possible. I mostly left 2) untouched, which has some special "// reverse presentation time with current time" logic that seems to make use of "internal knowledge" of what element is contained at what position in that vector and makes unifying code paths more challenging. (May still be possible, but would need a closer look.) > I tried to simplify this by creating a new typedef as: > typedef ::std::vector<rtl::Reference<Element> > ElementContainerPart; > > but it doesn't know "Element" in sd/source/console/PresenterToolBar.hxx. I had the same thought when coming across this code a few days earlier while looking into something else and independently had the same idea, implemented in commit f63690411df62f373d04d6b78bb93956f5532abf Author: Michael Weghorn <[email protected]> Date: Thu May 15 09:27:22 2025 +0200 sd console: Don't subclass std::vector -- You are receiving this mail because: You are the assignee for the bug.
