From 934034a6f0ecd7fc917406019a1526140f92e46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 22 Aug 2012 14:23:51 +0100 Subject: [PATCH] Resolves: rhbz#842292 crash in scrolling multiselection in draw --- ...2292-crash-in-calling-callback-whose.patch | 144 ++++++++++++++++++ libreoffice.spec | 3 + 2 files changed, 147 insertions(+) create mode 100644 0001-Resolves-rhbz-842292-crash-in-calling-callback-whose.patch diff --git a/0001-Resolves-rhbz-842292-crash-in-calling-callback-whose.patch b/0001-Resolves-rhbz-842292-crash-in-calling-callback-whose.patch new file mode 100644 index 0000000..c9a4527 --- /dev/null +++ b/0001-Resolves-rhbz-842292-crash-in-calling-callback-whose.patch @@ -0,0 +1,144 @@ +From c29af1572ad15ac5199a09e5812fb8354c165329 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Wed, 22 Aug 2012 14:20:32 +0100 +Subject: [PATCH] Resolves: rhbz#842292 crash in calling callback whose + instance was deleted + +Change-Id: I4cc04d59f48b42cc105703daa9983dd7c9f7af62 +--- + .../controller/SlsDragAndDropContext.cxx | 6 +++-- + .../slidesorter/controller/SlsScrollBarManager.cxx | 8 ++++--- + .../controller/SlsSelectionFunction.cxx | 26 ++++++++++++++++++---- + .../inc/controller/SlsScrollBarManager.hxx | 2 ++ + 4 files changed, 33 insertions(+), 9 deletions(-) + +diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx +index b8234b5..c1bf497 100644 +--- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx ++++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx +@@ -100,11 +100,13 @@ void DragAndDropContext::UpdatePosition ( + ::boost::shared_ptr pInsertionIndicatorHandler ( + mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler()); + +- if ( ! (bAllowAutoScroll ++ bool bDoAutoScroll = bAllowAutoScroll + && mpTargetSlideSorter->GetController().GetScrollBarManager().AutoScroll( + rMousePosition, + ::boost::bind( +- &DragAndDropContext::UpdatePosition, this, rMousePosition, eMode, false)))) ++ &DragAndDropContext::UpdatePosition, this, rMousePosition, eMode, false)); ++ ++ if (!bDoAutoScroll) + { + pInsertionIndicatorHandler->UpdatePosition(aMouseModelPosition, eMode); + +diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx +index a45f640..4a2d808 100644 +--- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx ++++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx +@@ -617,13 +617,15 @@ bool ScrollBarManager::RepeatAutoScroll (void) + } + } + +- maAutoScrollFunctor = ::boost::function(); ++ clearAutoScrollFunctor(); + mbIsAutoScrollActive = false; + return false; + } + +- +- ++void ScrollBarManager::clearAutoScrollFunctor() ++{ ++ maAutoScrollFunctor = ::boost::function(); ++} + + IMPL_LINK_NOARG(ScrollBarManager, AutoScrollTimeoutHandler) + { +diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +index 6217c07..16c23ad 100644 +--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx ++++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +@@ -273,6 +273,7 @@ private: + SelectionMode meSelectionMode; + Point maSecondCorner; + Pointer maSavedPointer; ++ bool mbAutoScrollInstalled; + sal_Int32 mnAnchorIndex; + sal_Int32 mnSecondIndex; + view::ButtonBar::Lock maButtonBarLock; +@@ -1503,6 +1504,7 @@ MultiSelectionModeHandler::MultiSelectionModeHandler ( + meSelectionMode(SM_Normal), + maSecondCorner(rMouseModelPosition), + maSavedPointer(mrSlideSorter.GetContentWindow()->GetPointer()), ++ mbAutoScrollInstalled(false), + mnAnchorIndex(-1), + mnSecondIndex(-1), + maButtonBarLock(rSlideSorter) +@@ -1523,6 +1525,12 @@ void MultiSelectionModeHandler::Initialize(const sal_uInt32 nEventCode) + + MultiSelectionModeHandler::~MultiSelectionModeHandler (void) + { ++ if (mbAutoScrollInstalled) ++ { ++ //a call to this handler's MultiSelectionModeHandler::UpdatePosition ++ //may be still waiting to be called back ++ mrSlideSorter.GetController().GetScrollBarManager().clearAutoScrollFunctor(); ++ } + mrSlideSorter.GetContentWindow()->SetPointer(maSavedPointer); + } + +@@ -1564,6 +1572,14 @@ void MultiSelectionModeHandler::ProcessEvent ( + bool MultiSelectionModeHandler::ProcessButtonUpEvent ( + SelectionFunction::EventDescriptor& rDescriptor) + { ++ if (mbAutoScrollInstalled) ++ { ++ //a call to this handler's MultiSelectionModeHandler::UpdatePosition ++ //may be still waiting to be called back ++ mrSlideSorter.GetController().GetScrollBarManager().clearAutoScrollFunctor(); ++ mbAutoScrollInstalled = false; ++ } ++ + if (Match(rDescriptor.mnEventCode, BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK)) + { + mrSelectionFunction.SwitchToNormalMode(); +@@ -1620,16 +1636,18 @@ void MultiSelectionModeHandler::UpdatePosition ( + SharedSdWindow pWindow (mrSlideSorter.GetContentWindow()); + const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition)); + +- if ( ! (bAllowAutoScroll && mrSlideSorter.GetController().GetScrollBarManager().AutoScroll( ++ bool bDoAutoScroll = bAllowAutoScroll && mrSlideSorter.GetController().GetScrollBarManager().AutoScroll( + rMousePosition, + ::boost::bind( + &MultiSelectionModeHandler::UpdatePosition, + this, + rMousePosition, +- false)))) +- { ++ false)); ++ ++ if (!bDoAutoScroll) + UpdateModelPosition(aMouseModelPosition); +- } ++ ++ mbAutoScrollInstalled |= bDoAutoScroll; + } + + +diff --git a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx +index 18807c1..41f3bde 100644 +--- a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx ++++ b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx +@@ -172,6 +172,8 @@ public: + + void StopAutoScroll (void); + ++ void clearAutoScrollFunctor(); ++ + enum Orientation { Orientation_Horizontal, Orientation_Vertical }; + enum Unit { Unit_Pixel, Unit_Slide }; + /** Scroll the slide sorter by setting the thumbs of the scroll bars and +-- +1.7.11.2 + diff --git a/libreoffice.spec b/libreoffice.spec index 9d6538e..d26729f 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -170,6 +170,7 @@ Patch9: 0001-disable-failing-check.patch Patch10: 0001-Resolves-rhbz-836937-insanely-slow-with-Zemberek-ins.patch Patch11: 0001-Resolves-rhbz-846775-Clipboard-must-be-disposed-befo.patch Patch12: 0001-configure-fix-S390X-CPUNAME.patch +Patch13: 0001-Resolves-rhbz-842292-crash-in-calling-callback-whose.patch %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %define instdir %{_libdir} @@ -779,6 +780,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc %patch10 -p1 -b .rhbz-836937-insanely-slow-with-Zemberek-ins.patch %patch11 -p1 -b .rhbz-846775-Clipboard-must-be-disposed-befo.patch %patch12 -p1 -b .0001-configure-fix-S390X-CPUNAME.patch +%patch13 -p1 -b .rhbz-842292-crash-in-calling-callback-whose.patch # TODO: check this # these are horribly incomplete--empty translations and copied english @@ -2015,6 +2017,7 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %changelog * Wed Aug 22 2012 Caolán McNamara - 1:3.6.1.1-2 - Resolves: rhbz#846775 Clipboard must be disposed before selection +- Resolves: rhbz#842292 crash in scrolling multiselection in draw * Wed Aug 15 2012 David Tardon - 1:3.6.1.1-1 - 3.6.1 rc1