[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 121280] quanta asserts and crash during php editing
From: "András" "Manţia" <amantia () kde ! org>
Date: 2006-02-28 21:38:21
Message-ID: 20060228213821.11330.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=121280
amantia kde org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From amantia kde org 2006-02-28 22:38 -------
SVN commit 514630 by amantia:
This should finnally fix a grave crash bug in Quanta, which appeared due to a node \
tree corruption.The patch does other things as well:
- stop background detailed parsing if the text was changed (this caused the \
corruption)
- parse only once after the user stopped typing, for real. The intention was there \
since several versions but DID NOT work! Now this should really make typing faster.
I will mark all related bugs as fixed. Reporters, in case you still see the crash or \
slow typing with Quanta 3.5.2 (or a recent - after this commit - snapshot/svn \
version), reopen the report or open a new one.
BUG: 121280, 122475, 122252, 120983
M +1 -1 parsers/node.cpp
M +23 -7 parsers/parser.cpp
M +1 -1 parsers/parsercommon.cpp
M +2 -0 parsers/saparser.cpp
M +9 -4 src/document.cpp
M +1 -0 src/document.h
--- branches/KDE/3.5/kdewebdev/quanta/parsers/node.cpp #514629:514630
@ -52,7 +52,7 @
//If it has crashed here, the Node doesn't exist anymore.
// If it has crashed the next line, it is a GroupElements bug.
//FIXME: Andras: or it is a VPL undo/redo bug...
-/* Q_ASSERT(tag); */ //disable as on some distros it causes a real assert=crash
+ Q_ASSERT(tag); //disable as on some distros it causes a real assert=crash
if (tag)
tag->setCleanStrBuilt(false);
--- branches/KDE/3.5/kdewebdev/quanta/parsers/parser.cpp #514629:514630
@ -43,8 +43,11 @
#include "quantacommon.h"
#include "document.h"
#include "qextfileinfo.h"
+
+
#include "kafkacommon.h"
#include "undoredo.h"
+
#include "dtds.h"
#include "structtreetag.h"
@ -515,10 +518,12 @
// clearGroups();
if (baseNode)
{
- delete baseNode;
- baseNode = 0L;
- m_node = 0L;
+ //kdDebug(24000) << "baseNode before delete = " << baseNode << endl;
+ //ParserCommon::coutTree(m_node, 2);
+ delete baseNode;
+ baseNode = 0L;
}
+ m_node = 0L;
Node *lastNode;
write = w;
@ -657,6 +662,7 @
}
void Parser::logReparse(NodeModifsSet *modifs, Document *w)
{
+
NodeModif *modif;
if (baseNode)
{
@ -796,6 +802,7 @
Node *node = firstNode;
bool closesPrevious = false;
NodeModif *modif;
+
//delete all the nodes between the firstNode and lastNode
while (node && node != lastNode )
{
@ -829,8 +836,11 @
node->parent = 0L;
node->next = 0L;
node->prev = 0L;
+
+ //delete node;
node->detachNode();
modif->setNode(node);
+
node = 0L;
i = 0;
j = 0;
@ -936,9 +946,11 @
}
}
+
modif->setChildrenMovedUp(i);
modif->setNeighboursMovedDown(j);
modifs->addNodeModif(modif);
+
node = nextNode;
// kdDebug(24000)<< "Node removed!" << endl;
@ -961,7 +973,6 @
NodeModifsSet *modifs = new NodeModifsSet();
NodeModif *modif;
-
// kdDebug(24000)<< "Node *Parser::rebuild()" << endl;
modifs->setIsModifiedAfter(w->isModified());
@ -989,9 +1000,10 @
(area.eLine < area.bLine || (area.eLine == area.bLine && area.eCol <= \
area.bCol)) //something strange has happened, like moving text with D&D inside the \
editor )
{
- logReparse(modifs, w);
- m_saParser->setParsingEnabled(saParserEnabled);
- return parse(w);
+ logReparse(modifs, w);
+ m_saParser->setParsingEnabled(saParserEnabled);
+ Node *n = parse(w, true);
+ return n;
}
kdDebug(24000) << QString("Invalid area: \
%1,%2,%3,%4").arg(area.bLine).arg(area.bCol).arg(area.eLine).arg(area.eCol) << "\n"; \
@ -1071,6 +1083,7 @ modif = new NodeModif();
modif->setType(NodeModif::NodeRemoved);
modif->setLocation(kafkaCommon::getLocation(lastNode));
+
if(lastInserted->prev)
lastInserted->prev->next = 0L;
if(lastInserted->parent && lastInserted->parent->child == lastInserted)
@ -1079,6 +1092,8 @
lastInserted->next = 0L;
lastInserted->parent = 0L;
lastInserted->child = 0L;
+// delete lastInserted;
+
lastInserted->detachNode();
modif->setNode(lastInserted);
modifs->addNodeModif(modif);
@ -1185,6 +1200,7 @
/* kdDebug(24000)<< "END"<< endl;
ParserCommon::coutTree(baseNode, 2);
kdDebug(24000)<< "************* End User Modification *****************" << \
endl;*/ +
w->docUndoRedo->addNewModifsSet(modifs, undoRedo::SourceModif);
}
kdDebug(24000) << "Rebuild: " << t.elapsed() << " ms \n";
--- branches/KDE/3.5/kdewebdev/quanta/parsers/parsercommon.cpp #514629:514630
@ -220,7 +220,7 @
else
output+= node->tag->tagStr().replace('\n'," ");
kdDebug(24000) << output <<" (" << node->tag->type << ") at pos " <<
- bLine << ":" << bCol << " - " << eLine << ":" << eCol << " This: \
"<< node << " Parent: " << node->parent << " Prev: " << node->prev << " Next: " << \
node->next << " Child: " << node->child << endl; + bLine << ":" << \
bCol << " - " << eLine << ":" << eCol << " This: "<< node << " Parent: " << \
node->parent << " Prev: " << node->prev << " Next: " << node->next << " Child: " << \
node->child << " Tag:" << node->tag << endl; /* for(j = 0; j < \
node->tag->attrCount(); j++) {
kdDebug(24000)<< " attr" << j << " " <<
--- branches/KDE/3.5/kdewebdev/quanta/parsers/saparser.cpp #514629:514630
@ -734,6 +734,7 @
Node *n = m_lastParsedNode;
if (m_useNext)
{
+// kdDebug(24000) << "m_lastParsedNode: " << m_lastParsedNode << endl;
n->next = s_next;
if (s_next)
s_next->prev = n;
@ -827,6 +828,7 @
{
if (m_useNext && s_currentNode)
{
+// kdDebug(24000) << "s_currentNode: " << s_currentNode << endl;
Node *n = s_currentNode;
n->next = s_next;
if (s_next)
--- branches/KDE/3.5/kdewebdev/quanta/src/document.cpp #514629:514630
@ -194,6 +194,7 @
dtdName = Project::ref()->defaultDTD();
reparseEnabled = true;
repaintEnabled = true;
+ delayedTextChangedEnabled = true;
docUndoRedo = new undoRedo(this);
//each document remember wheter it has a entry in quantarc
@ -2264,11 +2265,13 @
void Document::slotTextChanged()
{
changed = true;
- if (reparseEnabled)
+ parser->setSAParserEnabled(false); //disable special area parsing if the text was \
changed. + if (reparseEnabled && delayedTextChangedEnabled)
{
kdDebug(24000) << "Delayed text changed called." << endl;
//delay the handling, otherwise we may get wrong values for (line,column)
QTimer::singleShot(0, this, SLOT(slotDelayedTextChanged()));
+ delayedTextChangedEnabled = false;
}
}
@ -2276,13 +2279,14 @
{
if (!forced && typingInProgress)
{
- // kdDebug(24000) << "Reparsing delayed!" << endl;
+ kdDebug(24000) << "Reparsing delayed!" << endl;
parser->setParsingNeeded(true);
QTimer::singleShot(1000, this, SLOT(slotDelayedTextChanged()));
reparseEnabled = false;
+ delayedTextChangedEnabled = false;
return;
}
-
+
uint line, column;
QString oldNodeName = "";
Node *node;
@ -2311,7 +2315,7 @
}
}
}
-
+ parser->setSAParserEnabled(true); //enable special area parsing, it was disabled \
in slotTextChanged() baseNode = parser->rebuild(this);
if (qConfig.updateClosingTags && currentNode)
{
@ -2408,6 +2412,7 @
StructTreeView::ref()->slotReparse(this, baseNode , qConfig.expandLevel);
}
reparseEnabled = true;
+ delayedTextChangedEnabled = true;
}
/** Returns list of values for attribute */
--- branches/KDE/3.5/kdewebdev/quanta/src/document.h #514629:514630
@ -310,6 +310,7 @
bool hintRequested;
bool reparseEnabled;
bool repaintEnabled;
+ bool delayedTextChangedEnabled;
/** True if the document is dirty (has been modified outside). */
bool m_dirty;
QString m_md5sum;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic