Bug 122475 - unexpected crash when write something
Summary: unexpected crash when write something
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-22 11:46 UTC by Francesco Rabottini
Modified: 2006-02-28 22:38 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
pagamenti.php (7.02 KB, application/x-php)
2006-02-22 15:39 UTC, Francesco Rabottini
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francesco Rabottini 2006-02-22 11:46:54 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    Fedora RPMs
OS:                Linux

Using host libthread_db library "/lib/libthread_db.so.1".
`shared object read from target memory' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1209070752 (LWP 4555)]
[KCrash handler]
#6  0x00b85402 in __kernel_vsyscall ()
#7  0x002f0118 in raise () from /lib/libc.so.6
#8  0x002f1888 in abort () from /lib/libc.so.6
#9  0x0032522a in __libc_message () from /lib/libc.so.6
#10 0x0032c68e in _int_malloc () from /lib/libc.so.6
#11 0x0032d492 in malloc () from /lib/libc.so.6
#12 0x04f0e626 in operator new () from /usr/lib/libstdc++.so.6
#13 0x0814e39a in QValueList<QListViewItem*>::detachInternal (this=0x9d6f5d0)
    at /usr/lib/qt-3.3/include/qvaluelist.h:631
#14 0x08170ac1 in Node::detachNode (this=0x9d6f5b8)
    at /usr/lib/qt-3.3/include/qvaluelist.h:562
#15 0x08178796 in Parser::deleteNodes (this=0x8ed4510, firstNode=0x9cb7380, 
    lastNode=0x0, modifs=0x9553160) at parser.cpp:832
#16 0x0817eaab in Parser::rebuild (this=0x8ed4510, w=0x93cebb0)
    at parser.cpp:999
#17 0x080b5774 in Document::slotDelayedTextChanged (this=0x93cebb0, 
    forced=false) at document.cpp:2315
#18 0x080b92fd in Document::qt_invoke (this=0x93cebb0, _id=51, _o=0xbfa14204)
    at document.moc:249
#19 0x05be5eb4 in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#20 0x05f5e2e6 in QSignal::signal () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#21 0x05c03693 in QSignal::activate () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#22 0x05c0bf75 in QSingleShotTimer::event ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#23 0x05b810dd in QApplication::internalNotify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#24 0x05b81a5c in QApplication::notify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#25 0x02859841 in KApplication::notify () from /usr/lib/libkdecore.so.4
#26 0x05b75972 in QEventLoop::activateTimers ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#27 0x05b2b35a in QEventLoop::processEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#28 0x05b9982b in QEventLoop::enterLoop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#29 0x05b99736 in QEventLoop::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#30 0x05b80aa9 in QApplication::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#31 0x080a407c in main (argc=2, argv=0xbfa148f4) at main.cpp:212
#32 0x002dcd5f in __libc_start_main () from /lib/libc.so.6
#33 0x0808b641 in _start ()
Comment 1 András Manţia 2006-02-22 12:28:35 UTC
Is it reproduceable? Do you have an example file and a way to reproduce 
it?
Comment 2 Francesco Rabottini 2006-02-22 13:03:43 UTC
Alle 12:28, mercoledì 22 febbraio 2006, András ManÅ£ia ha scritto:
[bugs.kde.org quoted mail]

No, sry
because the bug occur when i'm writing a general php code.
 
Comment 3 Francesco Rabottini 2006-02-22 14:05:24 UTC
Alle 13:03, mercoledì 22 febbraio 2006, Francesco Rabottini ha scritto:
[bugs.kde.org quoted mail]
i have reported the bug!
Comment 4 András Manţia 2006-02-22 14:54:46 UTC
sorry?
Comment 5 Francesco Rabottini 2006-02-22 15:03:27 UTC
Alle 14:54, mercoledì 22 febbraio 2006, András ManÅ£ia ha scritto:
[bugs.kde.org quoted mail]

i'm lost, what u want?
Comment 6 Francesco Rabottini 2006-02-22 15:08:23 UTC
Alle 15:03, mercoledì 22 febbraio 2006, Francesco Rabottini ha scritto:
[bugs.kde.org quoted mail]

I have reported the bug!!!!!
Comment 7 András Manţia 2006-02-22 15:27:53 UTC
On Wednesday 22 February 2006 16:08, Francesco Rabottini wrote:
> I have reported the bug!!!!!


I don't understand why do you send this messages.

About what I want: a way to reproduce the bug (example file, what to 
type, where and when). Otherwise it will be hard to fix something which 
does not happen on my computer.
Comment 8 Francesco Rabottini 2006-02-22 15:39:40 UTC
Alle 15:27, mercoledì 22 febbraio 2006, András ManÅ£ia ha scritto:
[bugs.kde.org quoted mail]

i've just said that the bug occur when i'm typing general code, in many type
of scripts, if u want this files ther's no problem.
i'm using fedora core 4 and i've installed quanta from yum


Created an attachment (id=14813)
pagamenti.php
Comment 9 András Manţia 2006-02-22 15:55:38 UTC
Thanks for the file. Does it happen the crash when you type inside the 
<?php ?> or outside of it?
Comment 10 Francesco Rabottini 2006-02-22 16:03:34 UTC
Alle 14:54, mercoledì 22 febbraio 2006, András ManÅ£ia ha scritto:
[bugs.kde.org quoted mail]


Using host libthread_db library "/lib/libthread_db.so.1".
`shared object read from target memory' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1208706208 (LWP 5110)]
[KCrash handler]
#6  0x00e77402 in __kernel_vsyscall ()
#7  0x002f0118 in raise () from /lib/libc.so.6
#8  0x002f1888 in abort () from /lib/libc.so.6
#9  0x0032522a in __libc_message () from /lib/libc.so.6
#10 0x0032c68e in _int_malloc () from /lib/libc.so.6
#11 0x0032d492 in malloc () from /lib/libc.so.6
#12 0x04f0e626 in operator new () from /usr/lib/libstdc++.so.6
#13 0x0814e39a in QValueList<QListViewItem*>::detachInternal (this=0x9bcf3c8)
    at /usr/lib/qt-3.3/include/qvaluelist.h:631
#14 0x08170ac1 in Node::detachNode (this=0x9bcf3b0)
    at /usr/lib/qt-3.3/include/qvaluelist.h:562
#15 0x08178796 in Parser::deleteNodes (this=0x8d8e918, firstNode=0x9bf0fd8, 
    lastNode=0x0, modifs=0x9ac36e0) at parser.cpp:832
#16 0x0817eaab in Parser::rebuild (this=0x8d8e918, w=0x92a31a0)
    at parser.cpp:999
#17 0x080b5774 in Document::slotDelayedTextChanged (this=0x92a31a0, 
    forced=false) at document.cpp:2315
#18 0x080b92fd in Document::qt_invoke (this=0x92a31a0, _id=51, _o=0xbff6bd04)
    at document.moc:249
#19 0x05be5eb4 in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#20 0x05f5e2e6 in QSignal::signal () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#21 0x05c03693 in QSignal::activate () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#22 0x05c0bf75 in QSingleShotTimer::event ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#23 0x05b810dd in QApplication::internalNotify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#24 0x05b81a5c in QApplication::notify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#25 0x02859841 in KApplication::notify () from /usr/lib/libkdecore.so.4
#26 0x05b75972 in QEventLoop::activateTimers ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#27 0x05b2b35a in QEventLoop::processEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#28 0x05b99812 in QEventLoop::enterLoop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#29 0x05b99736 in QEventLoop::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#30 0x05b80aa9 in QApplication::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#31 0x080a407c in main (argc=2, argv=0xbff6c3f4) at main.cpp:212
#32 0x002dcd5f in __libc_start_main () from /lib/libc.so.6
#33 0x0808b641 in _start ()
Comment 11 Francesco Rabottini 2006-02-22 16:09:27 UTC
Alle 15:55, mercoledì 22 febbraio 2006, András ManÅ£ia ha scritto:
[bugs.kde.org quoted mail]

inside the php tags
Comment 12 András Manţia 2006-02-22 16:11:57 UTC
Does it matter what you type, or it is completely random?
Comment 13 Francesco Rabottini 2006-02-22 16:21:07 UTC
Alle 16:11, mercoledì 22 febbraio 2006, András ManÅ£ia ha scritto:
[bugs.kde.org quoted mail]

is completely random because when i reopen the file to edit it and  i rewrite
the same code nothing happen.
Comment 14 Jan Tönjes 2006-02-27 13:28:47 UTC
same here for me. its quite anoying. i am saving my php files right now after each line i write. sometimes i open quanta, just write a <br and before i close the bracket its crashing. it happens randomly and i can not repoduce the bug. using quanta 3.5.1 here...
Comment 15 Jan Tönjes 2006-02-27 13:29:42 UTC
same here for me. its quite anoying. i am saving my php files right now after each line i write. sometimes i open quanta, just write a <br and before i close the bracket its crashing. it happens randomly and i can not repoduce the bug. using quanta 3.5.1 here...
Comment 16 András Manţia 2006-02-28 22:38:13 UTC
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;