summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-06-07 17:20:34 +0200
committerXisco FaulĂ­ <xiscofauli@libreoffice.org>2019-06-10 11:57:58 +0200
commit79cae65f4725d0a8abd5639dc298002d11b2626c (patch)
treebe63d166240dae46750078fb1bd5045ae376d285 /svx
parent1ccf361e78eb0acd7ff682bf6c74ec8471abc0d4 (diff)
Related: tdf#111522 svx: fix crash with view1 doing textedit and resize/rotate
The two actually affected functions are SdrEditView::RotateMarkedObj() and SdrDragObjOwn::EndSdrDrag(), but it looks like the other functions in SdrEditView are safe to be changed the same way. I expect IsUndoEnabled() can't be changed, though: that would mean there would be no undo for the text edit itself, either. If other actions still crash, the pattern is the same: put a breakpoint on the SdrUndoAction constructor and see the backtrace to find the function that calls IsUndoEnabled() without calling CanDoSdrUndo() at the same time. Change-Id: If9324e311ec6e9f68a951559e903e14bb72ea31c Reviewed-on: https://gerrit.libreoffice.org/73669 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins (cherry picked from commit 9870ff897f088563426bee9567dd9cb722c2b929) Reviewed-on: https://gerrit.libreoffice.org/73748 Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svddrgmt.cxx2
-rw-r--r--svx/source/svdraw/svdedtv1.cxx24
2 files changed, 13 insertions, 13 deletions
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 05d44ce6bf70..f41a7991ccec 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -1366,7 +1366,7 @@ bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
{
std::unique_ptr<SdrUndoAction> pUndo;
std::unique_ptr<SdrUndoAction> pUndo2;
- const bool bUndo = getSdrDragView().IsUndoEnabled();
+ const bool bUndo = getSdrDragView().IsUndoEnabled() && getSdrDragView().CanDoSdrUndo();
if( bUndo )
{
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 66bc4c15ae69..47e05a0ad5e4 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -88,7 +88,7 @@ void SdrEditView::SetMarkedObjRect(const tools::Rectangle& rRect)
long w1=rRect.Right()-x1;
long h1=rRect.Bottom()-y1;
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
BegUndo(ImpGetDescriptionString(STR_EditPosSize));
@@ -208,7 +208,7 @@ void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy)
void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bCopy)
{
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
OUString aStr {ImpGetDescriptionString(STR_EditResize)};
@@ -242,7 +242,7 @@ void SdrEditView::ResizeMultMarkedObj(const Point& rRef,
const bool bWdh,
const bool bHgt)
{
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
BegUndo(ImpGetDescriptionString(STR_EditResize));
@@ -302,7 +302,7 @@ long SdrEditView::GetMarkedObjRotate() const
void SdrEditView::RotateMarkedObj(const Point& rRef, long nAngle, bool bCopy)
{
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
OUString aStr {ImpGetDescriptionString(STR_EditRotate)};
@@ -357,7 +357,7 @@ void SdrEditView::RotateMarkedObj(const Point& rRef, long nAngle, bool bCopy)
void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool bCopy)
{
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
@@ -456,7 +456,7 @@ long SdrEditView::GetMarkedObjShear() const
void SdrEditView::ShearMarkedObj(const Point& rRef, long nAngle, bool bVShear, bool bCopy)
{
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
@@ -569,7 +569,7 @@ void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookM
bool bVertical, bool bNoContortion, bool bCopy)
{
tools::Rectangle aMarkRect(GetMarkedObjRect());
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
bool bRotate=bNoContortion && eMode==SdrCrookMode::Rotate && IsRotateAllowed();
@@ -644,7 +644,7 @@ void SdrEditView::ImpDistortObj(SdrObject* pO, const tools::Rectangle& rRef, con
void SdrEditView::DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon& rDistortedRect, bool bNoContortion, bool bCopy)
{
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
@@ -753,7 +753,7 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr)
ShearMarkedObj(aAllSnapRect.Center(),nAngle,true);
}
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
// TODO: check if WhichRange is necessary.
const size_t nMarkCount=GetMarkedObjectCount();
@@ -1001,7 +1001,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll)
nWhich = aIter.NextWhich();
}
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
BegUndo(ImpGetDescriptionString(STR_EditSetAttributes));
@@ -1179,7 +1179,7 @@ void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRe
{
if (AreObjectsMarked())
{
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
@@ -1741,7 +1741,7 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert)
if (!GetMarkedObjectCount())
return;
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
OUString aStr(GetDescriptionOfMarkedObjects());