Bug 126994 - C++ import: "friend" declaration wreaks havoc
Summary: C++ import: "friend" declaration wreaks havoc
Status: RESOLVED WORKSFORME
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords: triaged
: 126797 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-05-09 00:33 UTC by Maksim Melnikau
Modified: 2014-02-02 18:05 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11.5


Attachments
umbrello crashed when I try open this file (10.10 KB, text/plain)
2006-05-09 00:35 UTC, Maksim Melnikau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maksim Melnikau 2006-05-09 00:33:18 UTC
Version:           3.5.2 (using KDE KDE 3.5.2)
Installed from:    Gentoo Packages
Compiler:          gcc version 4.1.0 (Gentoo 4.1.0)
 
OS:                Linux

I try to import the .h file, and umbrello crashed.
I tried to compile umbrello with debug, the result is the same.

=========Log========================
max_posedon@max_posedon test % umbrello
Qt: Locales not supported on X server
umbrello: WorkToolBar::loadPixmaps: n_buttonInfos = 43
umbrello: UMLListViewItem::init: s_pListView still NULL, setting it now
umbrello: CodeGeneratorFactory created
^[[D^[[Dumbrello: CppTree2Uml::parseElaboratedTypeSpecifier: text is class Fs
umbrello: CppTree2Uml::parseClassSpecifier: name=File
umbrello: CppTree2Uml::parseClassSpecifier: name=Block
umbrello: CppTree2Uml::parseElaboratedTypeSpecifier: text is class Fs
umbrello: CppTree2Uml::parseClassSpecifier: name=Directory
umbrello: CppTree2Uml::parseElaboratedTypeSpecifier: text is class Fs
umbrello: CppTree2Uml::parseClassSpecifier: name=Fs
umbrello: CppTree2Uml::parseElaboratedTypeSpecifier: text is class Directory
Comment 1 Maksim Melnikau 2006-05-09 00:35:42 UTC
Created attachment 15984 [details]
umbrello crashed when I try open this file
Comment 2 Oliver Kellogg 2006-05-16 08:43:36 UTC
SVN commit 541389 by okellogg:

getPackage(): Guard against circularity in the m_pUMLPackage chain.
BUG:126994


 M  +1 -0      ChangeLog  
 M  +9 -5      umbrello/umlobject.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #541388:541389
@@ -14,6 +14,7 @@
 * Crash loading xmi file (125331, 126968)
 * User interaction with UMLWidget improvements (126391)
 * Comments are cut short when generating PHP code (126480)
+* Freeze on C++ class import (126994)
 * Crash on importing Java 1.5 classes containing annotations (127160)
 
 Version 1.5.2
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlobject.cpp #541388:541389
@@ -349,15 +349,19 @@
 QString UMLObject::getPackage(QString separator) {
     if (m_pUMLPackage == NULL)
         return "";
-    QStringList pkgList;
+    UMLPackageList pkgList;
+    QStringList pkgNames;
     UMLPackage* pkg = m_pUMLPackage;
-    while (pkg != NULL) {
-        pkgList.prepend(pkg->getName());
-        pkg = pkg->getUMLPackage();
+    while (1) {
+        pkgList.prepend(pkg);
+        pkgNames.prepend(pkg->getName());
+        if ((pkg = pkg->getUMLPackage()) == NULL ||
+            pkgList.containsRef(pkg))
+            break;
     }
     if (separator.isEmpty())
         separator = UMLApp::app()->activeLanguageScopeSeparator();
-    return pkgList.join(separator);
+    return pkgNames.join(separator);
 }
 
 UMLPackageList UMLObject::getPackages() const {
Comment 3 Oliver Kellogg 2006-05-16 11:07:39 UTC
*** Bug 126797 has been marked as a duplicate of this bug. ***
Comment 4 Maksim Melnikau 2006-06-20 20:35:50 UTC
Gentoo
[ebuild   R   ] kde-base/umbrello-3.5.3  USE="debug kdeenablefinal kdehiddenvisibility xinerama -arts" 0 kB

thanks, bug with opening solved
BUT!!!
now umbrello crashed when I try move "Block" to the Class diogram
(with file Created an attachment (id=15984) )
=================================================================

max_posedon@max_posedon ~ % umbrello
Qt: Locales not supported on X server
umbrello: WorkToolBar::loadPixmaps: n_buttonInfos = 43
umbrello: UMLListViewItem::init: s_pListView still NULL, setting it now
umbrello: CppTree2Uml::parseElaboratedTypeSpecifier: text is class Fs
umbrello: CppTree2Uml::parseClassSpecifier: name=File
umbrello: CppTree2Uml::parseClassSpecifier: name=Block
umbrello: CppTree2Uml::parseElaboratedTypeSpecifier: text is class Fs
umbrello: CppTree2Uml::parseClassSpecifier: name=Directory
umbrello: CppTree2Uml::parseElaboratedTypeSpecifier: text is class Fs
umbrello: CppTree2Uml::parseClassSpecifier: name=Fs
umbrello: CppTree2Uml::parseElaboratedTypeSpecifier: text is class Directory
umbrello: UMLListView::getSelectedItems: selItems = 1
zsh: segmentation fault  umbrello
Comment 5 Oliver Kellogg 2006-06-20 23:46:24 UTC
Ouch... yes I confirm.
The C++ import has a problem with friend declarations so
if you're in a hurry and just want your classes imported
then comment out all "friend class XYZ;" lines in the file.
Comment 6 Vincent Ricard 2006-09-10 16:26:46 UTC
I opened umbrello (svn version); then i imported the attached file, there was no crash...
Comment 7 Oliver Kellogg 2006-09-10 17:07:44 UTC
Could be that there isn't always a crash. Still, on single stepping
thru the parse of a "friend class" line and I saw that there are
problems lurking. I suggest we leave the bug open till someone
finds time for an in-depth check.
Comment 8 FiNeX 2009-08-08 22:36:41 UTC
On the current trunk version the file makes umbrello freeze.
Comment 9 Ralf Habacker 2014-02-02 18:05:30 UTC
do not crash with 4.11.5