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 15:46:11 +0200
commit507771e499cf3ea658781d4e044ea4400888e3a6 (patch)
treec287c6f0fa41ee97dcd73847e6ef75c43ccc2997 /svx
parent2980fa249a2680f32915de470a9cd8840780c2a0 (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> (cherry picked from commit 79cae65f4725d0a8abd5639dc298002d11b2626c) Reviewed-on: https://gerrit.libreoffice.org/73757
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 cb0c3d1fa2c5..affd94e14bb6 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -1323,7 +1323,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 aa8e5d6df761..43f72e63369f 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -85,7 +85,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));
@@ -205,7 +205,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)};
@@ -239,7 +239,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));
@@ -299,7 +299,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)};
@@ -354,7 +354,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 )
{
@@ -453,7 +453,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 )
{
@@ -566,7 +566,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();
@@ -641,7 +641,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 )
{
@@ -750,7 +750,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();
@@ -998,7 +998,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));
@@ -1176,7 +1176,7 @@ void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRe
{
if (AreObjectsMarked())
{
- const bool bUndo = IsUndoEnabled();
+ const bool bUndo = IsUndoEnabled() && CanDoSdrUndo();
if( bUndo )
{
@@ -1729,7 +1729,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());