Thanks, Jacek. I put in those type of debug strings as you suggested (code is at the bottom)... and now I'm really starting to be worried of a fundamental bug in the compiler.
The "path" variable changes right in the middle of the function, during a call to a completely different function. I should mention that the "update_node()" function is in a plugin library, and the implementation of the offending "addFile()" is in the main application.
Here's the log that I get out, using the two scenarios. Notice that the "path" variable changes right between debug 5 and debug 6.
Qt Code:
LOG OUTPUT SCENARIO #1 ... 0 update_node:::::1: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::2: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::3: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::4: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::5: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::6: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::7: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::8: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::9: "c:/qt/4.3.2/include/qtgui/qwidget" 1 update_node:::::1: "c:/qt/4.3.2/include/qtgui/qapplication.h" 1 update_node:::::2: "c:/qt/4.3.2/include/qtgui/qapplication.h" 1 update_node:::::3: "c:/qt/4.3.2/include/qtgui/qapplication.h" 1 update_node:::::11: "c:/qt/4.3.2/include/qtgui/qapplication.h" 0 update_node:::::10: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::11: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::1: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::2: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::3: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::4: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::5: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::6: "c:/qt/4.3.2/include/qtcore/qdebug" 0 update_node:::::7: "c:/qt/4.3.2/include/qtcore/qdebug" 0 update_node:::::8: "c:/qt/4.3.2/include/qtcore/qdebug" 0 update_node:::::9: "c:/qt/4.3.2/include/qtcore/qdebug" ... LOG OUTPUT SCENARIO #2 ... 0 update_node:::::1: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::2: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::3: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::4: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::5: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::6: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::7: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::8: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::9: "c:/qt/4.3.2/include/qtgui/qapplication" 1 update_node:::::1: "c:/qt/4.3.2/include/qtgui/qapplication.h" 1 update_node:::::2: "c:/qt/4.3.2/include/qtgui/qapplication.h" 1 update_node:::::3: "c:/qt/4.3.2/include/qtgui/qapplication.h" 1 update_node:::::11: "c:/qt/4.3.2/include/qtgui/qapplication.h" 0 update_node:::::10: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::11: "c:/qt/4.3.2/include/qtgui/qapplication" 0 update_node:::::1: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::2: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::3: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::4: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::5: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::6: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::7: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::8: "c:/qt/4.3.2/include/qtgui/qwidget" 0 update_node:::::9: "c:/qt/4.3.2/include/qtgui/qwidget" ...To copy to clipboard, switch view to plain text mode
And here's the code that produced these two (only difference is in the top three lines):
CODE FOR SCENARIO #1
Qt Code:
static int level=0; //QString path=path_in; //apparently this is important :( qDebug() << level << "update_node:::::1:" <<path; if (!nodes.contains(path)) return; if (!nodes[path].needs_to_be_updated) return; nodes[path].needs_to_be_updated=false; nodes[path].children.clear(); QList<HaiQTag> tags=core->tagManager->byPath(path); emit file_tags_updated(path,tags); QStringList search_paths=include_search_paths; QStringList included_paths; qDebug() << level << "update_node:::::2:" <<path; for (int j=0; j<tags.count(); j++) { if (tags[j].tagtype=="pound_include") { if (!holdstr.isEmpty()) included_paths << holdstr; } } qDebug() << level << "update_node:::::3:" <<path; for (int j=0; j<included_paths.count(); j++) { qDebug() << level << "update_node:::::4:" <<path; if (!nodes.contains(path2)) { qDebug() << level << "update_node:::::5:" <<path; core->fileManager->addFile(path2); qDebug() << level << "update_node:::::6:" <<path; visible_files_node newnode; newnode.path=path2; newnode.needs_to_be_updated=true; nodes[path2]=newnode; } qDebug() << level << "update_node:::::7:" <<path; if ((!nodes[path].children.contains(path2))&&(path!=path2)) { nodes[path].children << path2; } qDebug() << level << "update_node:::::8:" <<path; if (nodes[path2].needs_to_be_updated) { qDebug() << level << "update_node:::::9:" <<path; level++; update_node(path2); level--; qDebug() << level << "update_node:::::10:" <<path; } } qDebug() << level << "update_node:::::11:" << path; }To copy to clipboard, switch view to plain text mode
CODE FOR SCENARIO #2
Qt Code:
static int level=0; qDebug() << level << "update_node:::::1:" <<path; if (!nodes.contains(path)) return; if (!nodes[path].needs_to_be_updated) return; nodes[path].needs_to_be_updated=false; nodes[path].children.clear(); QList<HaiQTag> tags=core->tagManager->byPath(path); emit file_tags_updated(path,tags); QStringList search_paths=include_search_paths; QStringList included_paths; qDebug() << level << "update_node:::::2:" <<path; for (int j=0; j<tags.count(); j++) { if (tags[j].tagtype=="pound_include") { if (!holdstr.isEmpty()) included_paths << holdstr; } } qDebug() << level << "update_node:::::3:" <<path; for (int j=0; j<included_paths.count(); j++) { qDebug() << level << "update_node:::::4:" <<path; if (!nodes.contains(path2)) { qDebug() << level << "update_node:::::5:" <<path; core->fileManager->addFile(path2); qDebug() << level << "update_node:::::6:" <<path; visible_files_node newnode; newnode.path=path2; newnode.needs_to_be_updated=true; nodes[path2]=newnode; } qDebug() << level << "update_node:::::7:" <<path; if ((!nodes[path].children.contains(path2))&&(path!=path2)) { nodes[path].children << path2; } qDebug() << level << "update_node:::::8:" <<path; if (nodes[path2].needs_to_be_updated) { qDebug() << level << "update_node:::::9:" <<path; level++; update_node(path2); level--; qDebug() << level << "update_node:::::10:" <<path; } } qDebug() << level << "update_node:::::11:" << path; }To copy to clipboard, switch view to plain text mode
and here is the declaration of addFile...
Qt Code:
To copy to clipboard, switch view to plain text mode





Reply With Quote


Bookmarks