From 19d2713d8fb8c2866b44c3e0653b82ab0b55eb77 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 15 Apr 2015 10:06:38 -0300 Subject: [PATCH] Avoid crash when we change the rotation algorithm This can happen when RotSprite needs a lot of memory and we change the algorithm from Fast to RotSprite. --- src/app/ui/editor/pixels_movement.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/ui/editor/pixels_movement.cpp b/src/app/ui/editor/pixels_movement.cpp index d40c53941..93dc151b4 100644 --- a/src/app/ui/editor/pixels_movement.cpp +++ b/src/app/ui/editor/pixels_movement.cpp @@ -15,6 +15,7 @@ #include "app/cmd/clear_mask.h" #include "app/cmd/deselect_mask.h" #include "app/cmd/set_mask.h" +#include "app/console.h" #include "app/document.h" #include "app/document_api.h" #include "app/modules/gui.h" @@ -648,11 +649,16 @@ void PixelsMovement::drawParallelogram(doc::Image* dst, doc::Image* src, void PixelsMovement::onSetRotationAlgorithm(RotationAlgorithm algorithm) { - redrawExtraImage(); - redrawCurrentMask(); - updateDocumentMask(); + try { + redrawExtraImage(); + redrawCurrentMask(); + updateDocumentMask(); - update_screen_for_document(m_document); + update_screen_for_document(m_document); + } + catch (const std::exception& ex) { + Console::showException(ex); + } } void PixelsMovement::updateDocumentMask()