Summary: | crash on importing qt 4 source | ||
---|---|---|---|
Product: | [Applications] umbrello | Reporter: | Ralf Habacker <ralf.habacker> |
Component: | general | Assignee: | Oliver Kellogg <okellogg> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | okellogg |
Priority: | NOR | ||
Version: | 2.13.1 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | All | ||
Latest Commit: | http://commits.kde.org/umbrello/3c553a2bfa20142468d8ef27345c5acb153c219b | Version Fixed In: | 4.13.3 |
Sentry Crash Report: |
Description
Ralf Habacker
2014-06-07 09:03:42 UTC
A workaround I found is adding the line indicated with '+'. void CppImport::feedTheModel(const QString& fileName) { if (ms_seenFiles.indexOf(fileName) != -1) return; QMap<QString, Dependence> deps = ms_driver->dependences(fileName); if (! deps.empty()) { QMap<QString, Dependence>::Iterator it; for (it = deps.begin(); it != deps.end(); ++it) { if (it.value().second == Dep_Global) // don't want these continue; QString includeFile = it.key(); if (includeFile.isEmpty()) { uError() << fileName << ": " << it.value().first << " not found"; continue; } uDebug() << fileName << ": " << includeFile << " => " << it.value().first; if (ms_seenFiles.indexOf(includeFile) == -1) + ms_seenFiles.append(includeFile); feedTheModel(includeFile); } } ParsedFilePointer ast = ms_driver->translationUnit(fileName); if (ast.isNull()) { uError() << fileName << " not found in list of parsed files"; return; } ms_seenFiles.append(fileName); CppTree2Uml modelFeeder(fileName, m_thread); modelFeeder.parseTranslationUnit(*ast); } (In reply to comment #1) > A workaround I found is adding the line indicated with '+'. > ms_seenFiles.append(includeFile); The problem is that the current file is added to the list of seen files after importing, which failed when an included file includes the current file. (In reply to comment #2) > (In reply to comment #1) > > A workaround I found is adding the line indicated with '+'. > > ms_seenFiles.append(includeFile); > > The problem is that the current file is added to the list of seen files > after importing, which failed when an included file includes the current > file. The ms_seenFiles is designed to not support mutual #includes - but I believe you are not talking about mutual includes but rather about importFiles() being called with more than one file? If so then IMHO we might clear ms_seenFiles in the loop in ClassImport::importFiles() : --- a/umbrello/codeimport/classimport.cpp +++ b/umbrello/codeimport/classimport.cpp @@ -67,6 +67,7 @@ bool ClassImport::importFiles(const QStringList& fileNames) bool result = true; umldoc->setLoading(true); foreach (const QString& fileName, fileNames) { + ms_seenFiles.clear(); umldoc->writeToStatusBar(i18n("Importing file: %1 Progress: %2/%3", fileName, processedFilesCount, fileNames.size())); if (!parseFile(fileName)) I haven't tried this out yet, though. Git commit 60fc217737de28fa9a3f90ea60de1efda9cce231 by Oliver Kellogg. Committed on 09/06/2014 at 10:52. Pushed by okellogg into branch 'master'. (In reply to comment #2) > (In reply to comment #1) > > A workaround I found is adding the line indicated with '+'. > > ms_seenFiles.append(includeFile); > > The problem is that the current file is added to the list of seen files > after importing, which failed when an included file includes the current > file. I tested this on current clucene/src/core/CLucene git master and I confirm your finding. I therefore commit both comment #2 and a clean version of comment #3: umbrello/codeimport/classimport.h - New virtual function initPerFile() lets concrete importers provide initializations which are executed before each single file parsed. This is different from initialize() in that initialize() is executed only once for all files parsed. umbrello/codeimport/classimport.cpp - Provide empty default implementation for new function initPerFile() - In function importFiles(), call importFile() instead of parseFile() - In function importFile(), call initPerFile() instead of initialize() umbrello/codeimport/cppimport.{h,cpp} - Reimplement function initPerFile() from ClassImport. - In function feedTheModel(), append includeFile to ms_seenFiles prior to calling feedTheModel(includeFile) if includeFile is not found in ms_seenFiles. umbrello/codeimport/import_utils.cpp - In function createUMLObject(), if name.startsWith("::") then remove the leading "::" from name, and set parentPkg to logicalView. umbrello/model_utils.cpp - In function findUMLObject(), if name.startsWith("::") then remove the leading "::" from name, and set currentObj to NULL. M +15 -6 umbrello/codeimport/classimport.cpp M +3 -1 umbrello/codeimport/classimport.h M +9 -1 umbrello/codeimport/cppimport.cpp M +3 -1 umbrello/codeimport/cppimport.h M +4 -1 umbrello/codeimport/import_utils.cpp M +10 -5 umbrello/model_utils.cpp http://commits.kde.org/umbrello/60fc217737de28fa9a3f90ea60de1efda9cce231 Git commit 3c553a2bfa20142468d8ef27345c5acb153c219b by Ralf Habacker, on behalf of Oliver Kellogg. Committed on 09/06/2014 at 10:52. Pushed by habacker into branch 'KDE/4.13'. (In reply to comment #2) > (In reply to comment #1) > > A workaround I found is adding the line indicated with '+'. > > ms_seenFiles.append(includeFile); > > The problem is that the current file is added to the list of seen files > after importing, which failed when an included file includes the current > file. I tested this on current clucene/src/core/CLucene git master and I confirm your finding. I therefore commit both comment #2 and a clean version of comment #3: umbrello/codeimport/classimport.h - New virtual function initPerFile() lets concrete importers provide initializations which are executed before each single file parsed. This is different from initialize() in that initialize() is executed only once for all files parsed. umbrello/codeimport/classimport.cpp - Provide empty default implementation for new function initPerFile() - In function importFiles(), call importFile() instead of parseFile() - In function importFile(), call initPerFile() instead of initialize() umbrello/codeimport/cppimport.{h,cpp} - Reimplement function initPerFile() from ClassImport. - In function feedTheModel(), append includeFile to ms_seenFiles prior to calling feedTheModel(includeFile) if includeFile is not found in ms_seenFiles. umbrello/codeimport/import_utils.cpp - In function createUMLObject(), if name.startsWith("::") then remove the leading "::" from name, and set parentPkg to logicalView. umbrello/model_utils.cpp - In function findUMLObject(), if name.startsWith("::") then remove the leading "::" from name, and set currentObj to NULL. FIXED-IN:4.13.3 (cherry picked from commit 60fc217737de28fa9a3f90ea60de1efda9cce231) M +15 -6 umbrello/codeimport/classimport.cpp M +3 -1 umbrello/codeimport/classimport.h M +9 -1 umbrello/codeimport/cppimport.cpp M +3 -1 umbrello/codeimport/cppimport.h M +4 -1 umbrello/codeimport/import_utils.cpp M +10 -5 umbrello/model_utils.cpp http://commits.kde.org/umbrello/3c553a2bfa20142468d8ef27345c5acb153c219b |