[rkward/frameworks] rkward/rbackend: Fix one (unfortunately not the only) crash related to command stack bookkeeping.
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Sat Oct 22 20:55:21 UTC 2016
Git commit a987576abb0406b9a8fd92be8e77ac3a177f6b34 by Thomas Friedrichsmeier.
Committed on 22/10/2016 at 20:54.
Pushed by tfry into branch 'frameworks'.
Fix one (unfortunately not the only) crash related to command stack bookkeeping.
M +3 -1 rkward/rbackend/rcommandstack.cpp
http://commits.kde.org/rkward/a987576abb0406b9a8fd92be8e77ac3a177f6b34
diff --git a/rkward/rbackend/rcommandstack.cpp b/rkward/rbackend/rcommandstack.cpp
index 4a7e505..0b7c64c 100644
--- a/rkward/rbackend/rcommandstack.cpp
+++ b/rkward/rbackend/rcommandstack.cpp
@@ -31,6 +31,7 @@ RCommandStack *RCommandStack::regular_stack;
RCommandStack::RCommandStack () : RCommandChain () {
RK_TRACE (RBACKEND);
closed = false;
+ parent = 0;
}
RCommandStack::~RCommandStack () {
@@ -139,6 +140,7 @@ void RCommandStack::pop (RCommandChain *item) {
RK_TRACE (RBACKEND);
RCommandChain *parent = item->parent;
+ RK_DEBUG (RBACKEND, DL_DEBUG, "removing form parent: %s", item->isCommand () ? qPrintable (item->toCommand ()->command ()) : "<chain>");
removeFromParent (item);
popIfCompleted (parent);
}
@@ -197,7 +199,6 @@ QModelIndex RCommandStackModel::index (int row, int column, const QModelIndex& p
RK_TRACE (RBACKEND);
RCommandChain* index_data = 0;
-
if (!parent.isValid ()) {
index_data = RCommandStack::regular_stack;
} else {
@@ -223,6 +224,7 @@ QModelIndex RCommandStackModel::parent (const QModelIndex& child) const {
RK_ASSERT (child_index);
RCommandChain* index_data = child_index->parent;
+ if (!index_data) return QModelIndex (); // probably the regular_stack
if (index_data) return (createIndex (0, 0, index_data));
}
More information about the rkward-tracker
mailing list