[calligra] plugins/textshape: Fix a crash in Krita due to accessing to an unsupported action in TextTool

Dmitry Kazakov dimula73 at gmail.com
Sat Dec 7 08:21:54 GMT 2013


Git commit fad45bd4002c1417f8b9f0e9fc0743812a2ff787 by Dmitry Kazakov.
Committed on 07/12/2013 at 07:23.
Pushed by dkazakov into branch 'master'.

Fix a crash in Krita due to accessing to an unsupported action in TextTool

The action "insert_table" (as well as other table-related actions) is added
by the Text Tool only in case the app supports 'useAdvancedText' feature.

That is why accessing the "insert_table" outside 'useAdvancedText' check
will cause a crash.

Please revert/change this commit if I understood something wrong :)

BUG:328326
CC:calligra-devel at kde.org

M  +2    -2    plugins/textshape/TextTool.cpp

http://commits.kde.org/calligra/fad45bd4002c1417f8b9f0e9fc0743812a2ff787

diff --git a/plugins/textshape/TextTool.cpp b/plugins/textshape/TextTool.cpp
index 6674790..7925fdb 100644
--- a/plugins/textshape/TextTool.cpp
+++ b/plugins/textshape/TextTool.cpp
@@ -1902,8 +1902,9 @@ void TextTool::updateActions()
     bool useAdvancedText = !(canvas()->resourceManager()->intResource(KoCanvasResourceManager::ApplicationSpeciality)
                             & KoCanvasResourceManager::NoAdvancedText);
     if (useAdvancedText) {
-        bool hasTable = textEditor->currentTable();
+        action("insert_table")->setEnabled(notInAnnotation);
 
+        bool hasTable = textEditor->currentTable();
         action("insert_tablerow_above")->setEnabled(hasTable && notInAnnotation);
         action("insert_tablerow_below")->setEnabled(hasTable && notInAnnotation);
         action("insert_tablecolumn_left")->setEnabled(hasTable && notInAnnotation);
@@ -1914,7 +1915,6 @@ void TextTool::updateActions()
         action("split_tablecells")->setEnabled(hasTable && notInAnnotation);
     }
     action("insert_annotation")->setEnabled(notInAnnotation);
-    action("insert_table")->setEnabled(notInAnnotation);
 
     ///TODO if selection contains several different format
     emit blockChanged(textEditor->block());




More information about the calligra-devel mailing list