[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra] kexi/kexiutils: Fixed crash when trying to modifying table field in form in DebugGUI
From:       Wojciech Kosowicz <pcellix () gmail ! com>
Date:       2014-04-30 21:20:45
Message-ID: E1Wfbvp-0002oL-HD () scm ! kde ! org
[Download RAW message or body]

Git commit bd2d0c2ffc211dd8296ab90df95aea64cf94495e by Wojciech Kosowicz.
Committed on 30/04/2014 at 21:07.
Pushed by wkosowicz into branch 'master'.

Fixed crash when trying to modifying table field in form in DebugGUI

BUG: 333933
REVIEW:117797

M  +10   -5    kexi/kexiutils/debuggui.cpp

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

diff --git a/kexi/kexiutils/debuggui.cpp b/kexi/kexiutils/debuggui.cpp
index fb22bfb..7fbe94b 100644
--- a/kexi/kexiutils/debuggui.cpp
+++ b/kexi/kexiutils/debuggui.cpp
@@ -138,7 +138,7 @@ static void addAlterTableActionDebug(const QString& text, int nestingLevel)
     //kDebug() << "availableNestingLevels: " << availableNestingLevels;
     //go up (availableNestingLevels-levelsToGoUp) levels
     lastItem = kexiAlterTableActionDebugPage->invisibleRootItem()->child(
-        kexiAlterTableActionDebugPage->invisibleRootItem()->childCount());
+        kexiAlterTableActionDebugPage->invisibleRootItem()->childCount()-1);
     int levelsToGoUp = availableNestingLevels - nestingLevel;
     while (levelsToGoUp > 0 && lastItem) {
         lastItem = lastItem->parent();
@@ -154,15 +154,20 @@ static void addAlterTableActionDebug(const QString& text, int nestingLevel)
         }
     } else {
         lastItem = kexiAlterTableActionDebugPage->invisibleRootItem()->child(
-            kexiAlterTableActionDebugPage->invisibleRootItem()->childCount());
+            kexiAlterTableActionDebugPage->invisibleRootItem()->childCount()-1);
         while (lastItem && lastItem->parent()) {
             lastItem = lastItem->parent();
         }
         //kDebug() << "lastItem2: " << (lastItem ? lastItem->text(0) : QString());
-        li = new QTreeWidgetItem(lastItem->parent(), lastItem);   //after
+        if (lastItem && lastItem->parent())
+             li = new QTreeWidgetItem(lastItem->parent(), lastItem);   //after
+        else if (!lastItem)
+             li = new QTreeWidgetItem(kexiAlterTableActionDebugPage->invisibleRootItem());
+        else if (!lastItem->parent())
+             li = new QTreeWidgetItem(kexiAlterTableActionDebugPage->invisibleRootItem(), lastItem);
     }
-    li->setText(0, text);
-    li->setExpanded(true);
+        li->setText(0, text);
+        li->setExpanded(true);
 }
 
 QWidget *KexiUtils::createDebugWindow(QWidget *parent)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic