[Libreoffice-commits] core.git: 2 commits - sc/source sw/inc sw/source
Caolán McNamara
caolanm at redhat.com
Wed Feb 19 10:12:52 CET 2014
sc/source/ui/unoobj/viewuno.cxx | 3 +
sw/inc/docsh.hxx | 6 ---
sw/inc/swwait.hxx | 19 ++++++++--
sw/source/ui/app/swwait.cxx | 70 +++++++++++++++++++++++++--------------
sw/source/ui/dochdl/swdtflvr.cxx | 3 -
5 files changed, 65 insertions(+), 36 deletions(-)
New commits:
commit b68e42c51823eb1690c0a0fa096124ec607616b2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Feb 18 20:50:35 2014 +0000
coverity#738809 Uninitialized scalar field
Change-Id: If2d985ae8ed940e22d755289b8176f92238bc911
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index a6d3e36..62f7e8e 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -468,7 +468,8 @@ ScTabViewObj::ScTabViewObj( ScTabViewShell* pViewSh ) :
aActivationListeners( 0 ),
nPreviousTab( 0 ),
bDrawSelModeSet(false),
- mbLeftMousePressed(false ),
+ bFilteredRangeSelection(false),
+ mbLeftMousePressed(false),
mbPendingSelectionChanged(false)
{
if (pViewSh)
commit 91a7096af027d3a5b12972a6a5256c2a52812686
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Mon Feb 17 16:38:10 2014 +0000
Resolves: #i124096# avoid unlock of dispatcher by...
recursive Lock-Unlock-pattern
(cherry picked from commit 8d769be834186ae6aa05e64d88b95a6b9d874c2e)
Conflicts:
sw/inc/docsh.hxx
sw/inc/swwait.hxx
sw/source/core/doc/docdesc.cxx
sw/source/core/edit/autofmt.cxx
sw/source/core/edit/edtab.cxx
sw/source/ui/app/docsh.cxx
sw/source/ui/app/docsh2.cxx
sw/source/ui/app/docshini.cxx
sw/source/ui/app/swwait.cxx
sw/source/ui/dbui/dbinsdlg.cxx
sw/source/ui/dbui/dbmgr.cxx
sw/source/ui/dochdl/swdtflvr.cxx
sw/source/ui/lingu/hyp.cxx
sw/source/ui/misc/glossary.cxx
sw/source/ui/misc/redlndlg.cxx
sw/source/ui/shells/annotsh.cxx
sw/source/ui/shells/drawsh.cxx
sw/source/ui/shells/drwtxtex.cxx
sw/source/ui/shells/frmsh.cxx
sw/source/ui/shells/textsh1.cxx
sw/source/ui/uiview/view2.cxx
sw/source/ui/uiview/viewsrch.cxx
Change-Id: I332d9ef6c3ce3205608850f9caccfa7b83a54ef3
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 5f919cf..04471ea 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -262,12 +262,6 @@ public:
sal_Int16 GetUpdateDocMode() const {return nUpdateDocMode;}
- /** Activate wait cursor for all windows of this document
- Optionally all dispatcher could be Locked
- Usually locking should be done using the class: SwWait. */
- void EnterWait( bool bLockDispatcher );
- void LeaveWait( bool bLockDispatcher );
-
void ToggleBrowserMode(sal_Bool bOn, SwView* pView);
sal_uLong LoadStylesFromFile( const OUString& rURL, SwgReaderOption& rOpt,
diff --git a/sw/inc/swwait.hxx b/sw/inc/swwait.hxx
index 6e4f422..bdf620f 100644
--- a/sw/inc/swwait.hxx
+++ b/sw/inc/swwait.hxx
@@ -21,15 +21,28 @@
#include "swdllapi.h"
+#include <boost/unordered_set.hpp>
+
class SwDocShell;
+class SfxDispatcher;
class SW_DLLPUBLIC SwWait
{
- SwDocShell &rDoc;
- bool bLock;
public:
- SwWait( SwDocShell &rDocShell, bool bLockDispatcher );
+ // Activate wait cursor for all windows of given document <rDocShell>
+ // Optional all dispatcher could be Locked
+ SwWait(
+ SwDocShell &rDocShell,
+ const bool bLockUnlockDispatcher );
~SwWait();
+
+private:
+ void EnterWaitAndLockDispatcher();
+ void LeaveWaitAndUnlockDispatcher();
+
+ SwDocShell& mrDoc;
+ const bool mbLockUnlockDispatcher;
+ boost::unordered_set< SfxDispatcher* > mpLockedDispatchers;
};
#endif
diff --git a/sw/source/ui/app/swwait.cxx b/sw/source/ui/app/swwait.cxx
index 683b825..9ac290e 100644
--- a/sw/source/ui/app/swwait.cxx
+++ b/sw/source/ui/app/swwait.cxx
@@ -17,47 +17,69 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <swwait.hxx>
+#include <docsh.hxx>
+
#include <sfx2/viewfrm.hxx>
#include <sfx2/dispatch.hxx>
#include <vcl/window.hxx>
-#include <docsh.hxx>
-#include <swwait.hxx>
-void SwDocShell::EnterWait( bool bLockDispatcher )
+SwWait::SwWait(
+ SwDocShell &rDocShell,
+ const bool bLockUnlockDispatcher )
+ : mrDoc ( rDocShell )
+ , mbLockUnlockDispatcher( bLockUnlockDispatcher )
+ , mpLockedDispatchers()
{
- SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, sal_False );
+ EnterWaitAndLockDispatcher();
+}
+
+SwWait::~SwWait()
+{
+ LeaveWaitAndUnlockDispatcher();
+}
+
+void SwWait::EnterWaitAndLockDispatcher()
+{
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( &mrDoc, sal_False );
while ( pFrame )
{
pFrame->GetWindow().EnterWait();
- if ( bLockDispatcher )
- pFrame->GetDispatcher()->Lock( sal_True );
- pFrame = SfxViewFrame::GetNext( *pFrame, this, sal_False );
+ if ( mbLockUnlockDispatcher )
+ {
+ // do not look already locked dispatchers
+ SfxDispatcher* pDispatcher = pFrame->GetDispatcher();
+ if ( !pDispatcher->IsLocked() )
+ {
+ pDispatcher->Lock( sal_True );
+ mpLockedDispatchers.insert( pDispatcher );
+ }
+ }
+
+ pFrame = SfxViewFrame::GetNext( *pFrame, &mrDoc, sal_False );
}
}
-void SwDocShell::LeaveWait( bool bLockDispatcher )
+void SwWait::LeaveWaitAndUnlockDispatcher()
{
- SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, sal_False );
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( &mrDoc, sal_False );
while ( pFrame )
{
pFrame->GetWindow().LeaveWait();
- if ( bLockDispatcher )
- pFrame->GetDispatcher()->Lock( sal_False );
- pFrame = SfxViewFrame::GetNext( *pFrame, this, sal_False );
- }
-}
-
-SwWait::SwWait( SwDocShell &rDocShell, bool bLockDispatcher ) :
- rDoc ( rDocShell ),
- bLock( bLockDispatcher )
-{
- rDoc.EnterWait( bLock );
-}
+ if ( mbLockUnlockDispatcher )
+ {
+ // only unlock dispatchers which had been locked
+ SfxDispatcher* pDispatcher = pFrame->GetDispatcher();
+ if ( mpLockedDispatchers.find( pDispatcher ) != mpLockedDispatchers.end() )
+ {
+ mpLockedDispatchers.erase( pDispatcher );
+ pDispatcher->Lock( sal_False );
+ }
+ }
-SwWait::~SwWait()
-{
- rDoc.LeaveWait( bLock );
+ pFrame = SfxViewFrame::GetNext( *pFrame, &mrDoc, sal_False );
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index 82e93fb..d9fa3f3 100644
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -1158,8 +1158,7 @@ bool SwTransferable::PasteData( TransferableDataHelper& rData,
const Point* pPt, sal_Int8 nDropAction,
sal_Bool bPasteSelection )
{
- SwWait aWait( *rSh.GetView().
- GetDocShell(), false );
+ SwWait aWait( *rSh.GetView().GetDocShell(), false );
boost::scoped_ptr<SwTrnsfrActionAndUndo> pAction;
SwModule* pMod = SW_MOD();
More information about the Libreoffice-commits
mailing list