summaryrefslogtreecommitdiff
path: root/dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002')
-rw-r--r--dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_00282
1 files changed, 82 insertions, 0 deletions
diff --git a/dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002 b/dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002
new file mode 100644
index 00000000..917bbf43
--- /dev/null
+++ b/dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002
@@ -0,0 +1,82 @@
+--- src/qstatemachine_history_fixed.cpp 2009-07-26 18:21:12.000000000 +0200
++++ src/qstatemachine.cpp 2009-07-27 15:46:45.000000000 +0200
+@@ -273,6 +273,27 @@
+ }
+ }
+
++QtState *QtStateMachinePrivate::findActiveLCA(const QList<QtAbstractState*> &states)
++{
++ if (states.isEmpty())
++ return rootState;
++ QList<QtState*> ancestors = properAncestors(states.at(0), 0);
++ for (int i = 0; i < ancestors.size(); ++i) {
++ QtState *anc = ancestors.at(i);
++ if (!configuration.contains(anc))
++ continue;
++ bool ok = true;
++ for (int j = states.size() - 1; (j > 0) && ok; --j) {
++ const QtAbstractState *s = states.at(j);
++ if (!isDescendantOf(s, anc))
++ ok = false;
++ }
++ if (ok)
++ return anc;
++ }
++ return rootState;
++}
++
+ QtState *QtStateMachinePrivate::findLCA(const QList<QtAbstractState*> &states)
+ {
+ if (states.isEmpty())
+@@ -378,8 +399,18 @@
+ QList<QtAbstractState*> lst = t->targetStates();
+ if (lst.isEmpty())
+ continue;
+- lst.prepend(t->sourceState());
+- QtAbstractState *lca = findLCA(lst);
++ QtAbstractState *lca;
++ if (isDescendantOf(t->targetState(), t->sourceState()))
++ {
++ lst.prepend(t->targetState());
++ lca = findActiveLCA(lst);
++ }
++ else
++ {
++ lst.prepend(t->sourceState());
++ lca = findLCA(lst);
++ }
++
+ {
+ QSet<QtAbstractState*>::const_iterator it;
+ for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) {
+@@ -451,8 +482,17 @@
+ QList<QtAbstractState*> lst = t->targetStates();
+ if (lst.isEmpty())
+ continue;
+- lst.prepend(t->sourceState());
+- QtState *lca = findLCA(lst);
++ QtState *lca;
++ if (isDescendantOf(t->targetState(), t->sourceState()))
++ {
++ lst.prepend(t->targetState());
++ lca = findActiveLCA(lst);
++ }
++ else
++ {
++ lst.prepend(t->sourceState());
++ lca = findLCA(lst);
++ }
+ for (int j = 1; j < lst.size(); ++j) {
+ QtAbstractState *s = lst.at(j);
+ addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry);
+diff -ru src_old/qstatemachine_p.h src/qstatemachine_p.h
+--- src_old/qstatemachine_p.h 2009-07-26 18:38:06.000000000 +0200
++++ src/qstatemachine_p.h 2009-07-26 18:37:15.000000000 +0200
+@@ -109,6 +109,7 @@
+
+ static QtStateMachinePrivate *get(QtStateMachine *q);
+
++ QtState *findActiveLCA(const QList<QtAbstractState*> &states);
+ static QtState *findLCA(const QList<QtAbstractState*> &states);
+
+ static bool stateEntryLessThan(QtAbstractState *s1, QtAbstractState *s2);