[libreoffice/f20] make dragging and dropping slides stop crashing

Caolán McNamara caolanm at fedoraproject.org
Thu Dec 12 14:15:02 UTC 2013


commit 20ea5ae07b002dac2d7801e38b83a574e1dbe310
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 12 14:15:05 2013 +0000

    make dragging and dropping slides stop crashing

 ...ragging-and-dropping-slides-stop-crashing.patch |  264 ++++++++++++++++++++
 libreoffice.spec                                   |    7 +-
 2 files changed, 270 insertions(+), 1 deletions(-)
---
diff --git a/0001-make-dragging-and-dropping-slides-stop-crashing.patch b/0001-make-dragging-and-dropping-slides-stop-crashing.patch
new file mode 100644
index 0000000..7b91408
--- /dev/null
+++ b/0001-make-dragging-and-dropping-slides-stop-crashing.patch
@@ -0,0 +1,264 @@
+From 55ca953c06b618abb1f224848ea826025633b8cf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Tue, 10 Dec 2013 16:54:59 +0000
+Subject: [PATCH] make dragging and dropping slides stop crashing
+
+accessibility cruft is still listening to dead tables so crashes in
+slidesorting in main panel if moved slide has tables in it after visiting slide
+sorter once.
+
+(cherry picked from commit 0b8e2e5efe20519e8b5563314bac0cbb84a3b967)
+
+Conflicts:
+	svx/source/table/svdotable.cxx
+
+Change-Id: I09f9a73b01fb2ddf059402146acdc7bd823798b9
+
+disposed but not dtored
+
+just die when you are supposed to, without this endless amounts of accessiblity
+cells remain after sorting slides with tables in them
+
+(cherry picked from commit 1c28065d8fe3e9a1394a7ecfc29e95a9639a1012)
+
+Conflicts:
+	svx/source/table/accessibletableshape.cxx
+
+Change-Id: Ice9a86b8b806e58f9bf871341a38f7729798dda9
+(cherry picked from commit a90e08cb15e712e1d15a16de9a2677e57d81fd13)
+
+fix occasional crash on dragging and dropping pages in slidesorters
+
+pages go into the cache, and sometimes they get deleted before the
+cache gets processed. Remove deleted pages when they go away
+
+Change-Id: I291072a8541f4ca36979e9914975d81cc23a9497
+(cherry picked from commit abe9d1463282690313aaf91d2a54011d10b900b9)
+(cherry picked from commit 026e9335d792c6557255f064960e0ef6d28728e0)
+
+pages with equal Priority and Class getting dropped
+
+Change-Id: Ib053dc4b6e5fb5f01f48c71a4b295a53c0ec6715
+(cherry picked from commit 9790588da4b2de455ffc7a2cc69f26539823c3da)
+(cherry picked from commit be366ad7690b190c5ef4dc42311a4df6b7dcce4b)
+---
+ sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx | 44 ++++++++++++++++++----
+ sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx | 12 ++++--
+ svx/source/table/accessibletableshape.cxx          |  6 +++
+ svx/source/table/svdotable.cxx                     | 20 +++++++++-
+ 4 files changed, 71 insertions(+), 11 deletions(-)
+
+diff --git a/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx b/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx
+index d02bae1..cdc2b57 100644
+--- a/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx
++++ b/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx
+@@ -40,9 +40,14 @@ public:
+         bool operator() (const Request& rRequest1, const Request& rRequest2)
+         {
+             if (rRequest1.meClass == rRequest2.meClass)
+-                return (rRequest1.mnPriorityInClass > rRequest2.mnPriorityInClass);
+-            else
+-                return (rRequest1.meClass < rRequest2.meClass);
++            {
++                if (rRequest1.mnPriorityInClass == rRequest2.mnPriorityInClass)
++                {
++                    return rRequest1.maKey < rRequest2.maKey;
++                }
++                return rRequest1.mnPriorityInClass > rRequest2.mnPriorityInClass;
++            }
++            return rRequest1.meClass < rRequest2.meClass;
+         }
+     };
+     /** Request data is compared arbitrarily by their addresses in memory.
+@@ -89,6 +94,7 @@ RequestQueue::RequestQueue (const SharedCacheContext& rpCacheContext)
+ 
+ RequestQueue::~RequestQueue (void)
+ {
++    Clear();
+ }
+ 
+ 
+@@ -115,7 +121,15 @@ void RequestQueue::AddRequest (
+     // order.
+     sal_Int32 nPriority (mpCacheContext->GetPriority(aKey));
+     Request aRequest (aKey, nPriority, eRequestClass);
+-    mpRequestQueue->insert(aRequest);
++
++    std::pair<Container::iterator,bool> ret = mpRequestQueue->insert(aRequest);
++    bool bInserted = ret.second == true;
++
++    if (bInserted)
++    {
++        SdrPage *pPage = const_cast<SdrPage*>(aRequest.maKey);
++        pPage->AddPageUser(*this);
++    }
+ 
+     SSCD_SET_REQUEST_CLASS(aKey,eRequestClass);
+ 
+@@ -126,8 +140,11 @@ void RequestQueue::AddRequest (
+ #endif
+ }
+ 
+-
+-
++void RequestQueue::PageInDestruction(const SdrPage& rPage)
++{
++    //remove any requests pending for this page which is going away now
++    RemoveRequest(&rPage);
++}
+ 
+ bool RequestQueue::RemoveRequest (
+     CacheKey aKey)
+@@ -147,7 +164,11 @@ bool RequestQueue::RemoveRequest (
+                 mnMinimumPriority++;
+             else if (aRequestIterator->mnPriorityInClass == mnMaximumPriority-1)
+                 mnMaximumPriority--;
++
++            SdrPage *pPage = const_cast<SdrPage*>(aRequestIterator->maKey);
++            pPage->RemovePageUser(*this);
+             mpRequestQueue->erase(aRequestIterator);
++
+             bRequestWasRemoved = true;
+ 
+             if (bRequestWasRemoved)
+@@ -224,7 +245,10 @@ void RequestQueue::PopFront (void)
+     {
+         SSCD_SET_STATUS(maRequestQueue.begin()->mpData->GetPage(),NONE);
+ 
+-        mpRequestQueue->erase(mpRequestQueue->begin());
++        Container::const_iterator aIter(mpRequestQueue->begin());
++        SdrPage *pPage = const_cast<SdrPage*>(aIter->maKey);
++        pPage->RemovePageUser(*this);
++        mpRequestQueue->erase(aIter);
+ 
+         // Reset the priority counter if possible.
+         if (mpRequestQueue->empty())
+@@ -251,6 +275,12 @@ void RequestQueue::Clear (void)
+ {
+     ::osl::MutexGuard aGuard (maMutex);
+ 
++    for (Container::iterator aI = mpRequestQueue->begin(), aEnd = mpRequestQueue->end(); aI != aEnd; ++aI)
++    {
++        SdrPage *pPage = const_cast<SdrPage*>(aI->maKey);
++        pPage->RemovePageUser(*this);
++    }
++
+     mpRequestQueue->clear();
+     mnMinimumPriority = 0;
+     mnMaximumPriority = 1;
+diff --git a/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx b/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
+index 78a4627..088a135 100644
+--- a/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
++++ b/sd/source/ui/slidesorter/cache/SlsRequestQueue.hxx
+@@ -24,7 +24,8 @@
+ #include "cache/SlsCacheContext.hxx"
+ #include "taskpane/SlideSorterCacheDisplay.hxx"
+ #include <drawdoc.hxx>
+-#include "osl/mutex.hxx"
++#include <osl/mutex.hxx>
++#include <svx/sdrpageuser.hxx>
+ 
+ 
+ namespace sd { namespace slidesorter { namespace cache {
+@@ -34,11 +35,11 @@ class RequestData;
+ /** The request queue stores requests that are described by the RequestData
+     sorted according to priority class and then priority.
+ */
+-class RequestQueue
++class RequestQueue : public sdr::PageUser
+ {
+ public:
+     RequestQueue (const SharedCacheContext& rpCacheContext);
+-    ~RequestQueue (void);
++    virtual ~RequestQueue();
+ 
+     /** Insert a request with highest or lowest priority in its priority
+         class.  When the request is already present then it is first
+@@ -99,6 +100,11 @@ public:
+     */
+     ::osl::Mutex& GetMutex (void);
+ 
++    /** Ensure we don't hand out a page deleted before anyone got a
++        chance to process it
++    */
++    virtual void PageInDestruction(const SdrPage& rPage);
++
+ private:
+     ::osl::Mutex maMutex;
+     class Container;
+diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx
+index a5e910e..8872591 100644
+--- a/svx/source/table/accessibletableshape.cxx
++++ b/svx/source/table/accessibletableshape.cxx
+@@ -113,6 +113,12 @@ void AccessibleTableShapeImpl::dispose()
+ {
+     if( mxTable.is() )
+     {
++        //remove all the cell's acc object in table's dispose.
++        for( AccessibleCellMap::iterator iter( maChildMap.begin() ); iter != maChildMap.end(); iter++ )
++        {
++            (*iter).second->dispose();
++        }
++        maChildMap.clear();
+         Reference< XModifyListener > xListener( this );
+         mxTable->removeModifyListener( xListener );
+         mxTable.clear();
+diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
+index bed3988..474d42d 100644
+--- a/svx/source/table/svdotable.cxx
++++ b/svx/source/table/svdotable.cxx
+@@ -268,9 +268,9 @@ void SdrTableObjImpl::init( SdrTableObj* pTable, sal_Int32 nColumns, sal_Int32 n
+     mpTableObj = pTable;
+     mxTable = new TableModel( pTable );
+     mxTable->init( nColumns, nRows );
+-    mpLayouter = new TableLayouter( mxTable );
+     Reference< XModifyListener > xListener( static_cast< ::com::sun::star::util::XModifyListener* >(this) );
+     mxTable->addModifyListener( xListener );
++    mpLayouter = new TableLayouter( mxTable );
+     UpdateWritingMode();
+     LayoutTable( mpTableObj->aRect, true, true );
+     mpTableObj->maLogicRect = mpTableObj->aRect;
+@@ -282,6 +282,8 @@ SdrTableObjImpl& SdrTableObjImpl::operator=( const SdrTableObjImpl& rSource )
+ {
+     if (this != &rSource)
+     {
++        disconnectTableStyle();
++
+         if( mpLayouter )
+         {
+             delete mpLayouter;
+@@ -307,6 +309,8 @@ SdrTableObjImpl& SdrTableObjImpl::operator=( const SdrTableObjImpl& rSource )
+         ApplyCellStyles();
+         mpTableObj->aRect = mpTableObj->maLogicRect;
+         LayoutTable( mpTableObj->aRect, false, false );
++
++        connectTableStyle();
+     }
+     return *this;
+ }
+@@ -453,8 +457,22 @@ bool SdrTableObjImpl::ApplyCellStyles()
+ 
+ void SdrTableObjImpl::dispose()
+ {
++    disconnectTableStyle();
++    mxTableStyle.clear();
++
++    if( mpLayouter )
++    {
++        delete mpLayouter;
++        mpLayouter = 0;
++    }
++
+     if( mxTable.is() )
++    {
++        Reference< XModifyListener > xListener( static_cast< ::com::sun::star::util::XModifyListener* >(this) );
++        mxTable->removeModifyListener( xListener );
+         mxTable->dispose();
++        mxTable.clear();
++    }
+ }
+ 
+ // -----------------------------------------------------------------------------
+-- 
+1.8.3.1
+
diff --git a/libreoffice.spec b/libreoffice.spec
index 808770e..4e63d0f 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:        11%{?libo_prerelease}%{?dist}
+Release:        12%{?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/
@@ -282,6 +282,7 @@ Patch41: 0001-Resolves-rhbz-1035092-no-shortcut-key-for-Italian-To.patch
 Patch42: 0001-Resolves-rhbz-912529-Kerkis-SmallCaps-shown-instead-.patch
 Patch43: 0001-Resolves-rhbz-1038189-refresh-printer-list-when-prin.patch
 Patch44: 0001-Related-i123048-Corrected-connector-layout-after-rel.patch
+Patch45: 0001-make-dragging-and-dropping-slides-stop-crashing.patch
 
 %define instdir %{_libdir}
 %define baseinstdir %{instdir}/libreoffice
@@ -1061,6 +1062,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch42 -p1 -b .rhbz-912529-Kerkis-SmallCaps-shown-instead-.patch
 %patch43 -p1 -b .rhbz-1038189-refresh-printer-list-when-prin.patch
 %patch44 -p1 -b .i123048-Corrected-connector-layout-after-rel.patch
+%patch45 -p1 -b .make-dragging-and-dropping-slides-stop-crashing.patch
 
 # TODO: check this
 # these are horribly incomplete--empty translations and copied english
@@ -2150,6 +2152,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 %endif
 
 %changelog
+* Thu Dec 12 2013 Caolán McNamara <caolanm at redhat.com> - 1:4.1.3.2-12
+- make dragging and dropping slides stop crashing
+
 * Tue Dec 10 2013 Caolán McNamara <caolanm at redhat.com> - 1:4.1.3.2-11
 - Resolves: rhbz#1039902 Corrected connector layout after reload
 


More information about the scm-commits mailing list