Do KoCanvasControllerWidget::updateDocumentSize only if size changed (fixes loop)

Sebastian Sauer mail at dipe.org
Sun May 15 20:28:30 BST 2011


Hi,

please see following patch for libs/flake/KoCanvasControllerWidget.cpp to 
prevent doing anything on KoCanvasControllerWidget::updateDocumentSize.

This fixes the infinite loop with the 
http://www.zagge.de/anchor/110407/wiki.documentfoundation.org%252Fcgi_img_auth.php%252Fe%252Fe9%252F%25301%25303GS3-
StylesAndTemplates.odt OpenDocument.

Ok to commit?

diff --git a/libs/flake/KoCanvasControllerWidget.cpp 
b/libs/flake/KoCanvasControllerWidget.cpp
index 47c4afb..cb8aafb 100644
--- a/libs/flake/KoCanvasControllerWidget.cpp
+++ b/libs/flake/KoCanvasControllerWidget.cpp
@@ -508,6 +508,9 @@ void KoCanvasControllerWidget::setToolOptionWidgets(const 
QMap<QString, QWidget
 
 void KoCanvasControllerWidget::updateDocumentSize(const QSize &sz, bool 
recalculateCenter)
 {
+    if (KoCanvasController::documentSize() == sz)
+        return;
+    
     if (!recalculateCenter) {
         // assume the distance from the top stays equal and recalculate the 
center.
         setPreferredCenterFractionX(documentSize().width() * 
preferredCenterFractionX() / sz.width());



More information about the calligra-devel mailing list