Bug 95954

Summary: Umbrello using 100% of CPU when dragging
Product: [Applications] umbrello Reporter: Emmanuel Pinault <seatmanu>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.3.1   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Emmanuel Pinault 2004-12-28 23:36:49 UTC
Version:           1.3.1 (using KDE KDE 3.3.2)
Installed from:    Debian testing/unstable Packages
OS:                Linux

To reproduce with umbrello 1.3.1 (cannot get the 1.3.2 package yet in debian):

I have created a new class
I have created a new package 

I try from the treeview on the left to drag and drop the class into the package
and it is causing the application to hang and CPU to go 100%

It is happening everytime

Thanks

Manu
Comment 1 Oliver Kellogg 2004-12-29 11:59:19 UTC
I cannot reproduce this here and I also cannot reproduce the related bugs 57667 and 90506.
It would be great help if you could provide more information:
Does this problem also happen when running in the debugger?
If so, please press Control-C in the debugger and attach the backtrace.
Comment 2 Jonathan Riddell 2005-01-09 04:37:03 UTC
Backtrace:

#0  0xb713f04b in QListViewItem::listView () from /usr/lib/libqt-mt.so.3
#1  0xb7138fb0 in QListViewItem::setText () from /usr/lib/libqt-mt.so.3
#2  0xb7136643 in QListViewItem::QListViewItem () from /usr/lib/libqt-mt.so.3
#3  0x081aea8f in UMLListViewItem (this=0x85e1c90, parent=0x85e1b28, name=@0xbffc5aa0, t=lvt_Class,
    o=0x858efc0) at /home/jr/devel/kdesdk/umbrello/umbrello/umllistviewitem.cpp:67
#4  0x081b0bb0 in UMLListViewItem::deepCopy (this=0x85e1b28, newParent=0x85e1b28)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umllistviewitem.cpp:544
#5  0x081b0c32 in UMLListViewItem::deepCopy (this=0x85e19c0, newParent=0x85e19c0)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umllistviewitem.cpp:549
#6  0x081b0c32 in UMLListViewItem::deepCopy (this=0x85e1858, newParent=0x85e1858)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umllistviewitem.cpp:549
#7  0x081b0c32 in UMLListViewItem::deepCopy (this=0x85e16f0, newParent=0x85e16f0)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umllistviewitem.cpp:549
#8  0x081b0c32 in UMLListViewItem::deepCopy (this=0x85e1588, newParent=0x85e1588)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umllistviewitem.cpp:549
.......

#2048 0x081b0c32 in UMLListViewItem::deepCopy (this=0x87b1860, newParent=0x87b1860)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umllistviewitem.cpp:549
#2049 0x081b0c32 in UMLListViewItem::deepCopy (this=0x8787730, newParent=0x8787730)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umllistviewitem.cpp:549
#2050 0x081a6ce5 in UMLListView::moveObject (this=0x85186e8, srcId=
        {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<No data fields>}, _M_p = 0x8786634 "152"}, static _S_empty_rep_storage = {0, 0, 0, 0}}, srcType=lvt_Class, newParent=0x8787730)
---Type <return> to continue, or q <return> to quit---
    at /home/jr/devel/kdesdk/umbrello/umbrello/umllistview.cpp:1133
#2051 0x081a6f1b in UMLListView::slotDropped (this=0x85186e8, de=0xbfffe0c0, item=0x8787730)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umllistview.cpp:1174
#2052 0x081ad25d in UMLListView::qt_invoke (this=0x85186e8, _id=116, _o=0xbfffdb10) at umllistview.moc:203
#2053 0xb705b51c in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#2054 0xb79cbe85 in KListView::dropped (this=0x85186e8, t0=0xbfffe0c0, t1=0x8523b30, t2=0x8787730)
    at klistview.moc:420
#2055 0xb79c6006 in KListView::contentsDropEvent (this=0x85186e8, e=0xbfffe0c0)
    at /home/jr/devel/kdelibs/kdeui/klistview.cpp:912
#2056 0xb717126a in QScrollView::viewportDropEvent () from /usr/lib/libqt-mt.so.3
#2057 0xb7170907 in QScrollView::eventFilter () from /usr/lib/libqt-mt.so.3
#2058 0xb713edb8 in QListView::eventFilter () from /usr/lib/libqt-mt.so.3
#2059 0xb7058e4e in QObject::activate_filters () from /usr/lib/libqt-mt.so.3
#2060 0xb7058d7c in QObject::event () from /usr/lib/libqt-mt.so.3
#2061 0xb70915ff in QWidget::event () from /usr/lib/libqt-mt.so.3
#2062 0xb6ffebbf in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#2063 0xb6ffe1be in QApplication::notify () from /usr/lib/libqt-mt.so.3
#2064 0xb76944f0 in KApplication::notify (this=0xbffff710, receiver=0x8519220, event=0xbfffe0c0)
    at /home/jr/devel/kdelibs/kdecore/kapplication.cpp:543
#2065 0xb6fa34f1 in qt_handle_xdnd_drop () from /usr/lib/libqt-mt.so.3
#2066 0xb6fa48d8 in QDragManager::drop () from /usr/lib/libqt-mt.so.3
#2067 0xb6fa380c in QDragManager::eventFilter () from /usr/lib/libqt-mt.so.3
#2068 0xb6ffec5d in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#2069 0xb6ffe2b4 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#2070 0xb76944f0 in KApplication::notify (this=0xbffff710, receiver=0x8726490, event=0xbfffe510)
    at /home/jr/devel/kdelibs/kdecore/kapplication.cpp:543
#2071 0xb6f93630 in QETWidget::translateMouseEvent () from /usr/lib/libqt-mt.so.3
#2072 0xb6f912be in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#2073 0xb6fa8194 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#2074 0xb7010f18 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#2075 0xb6ffee71 in QApplication::enter_loop () from /usr/lib/libqt-mt.so.3
#2076 0xb6fa54ba in QDragManager::drag () from /usr/lib/libqt-mt.so.3
#2077 0xb70084e8 in QDragObject::drag () from /usr/lib/libqt-mt.so.3
#2078 0xb700847a in QDragObject::dragCopy () from /usr/lib/libqt-mt.so.3
#2079 0x00000001 in ?? ()
#2080 0x081a5e0d in UMLListView::startDrag (this=0x85186e8)
    at /home/jr/devel/kdesdk/umbrello/umbrello/umllistview.cpp:766
#2081 0xb79c5a81 in KListView::contentsMouseMoveEvent (this=0x85186e8, e=0xbfffebe0)
    at /home/jr/devel/kdelibs/kdeui/klistview.cpp:827
#2082 0xb71710a2 in QScrollView::viewportMouseMoveEvent () from /usr/lib/libqt-mt.so.3
#2083 0xb71707db in QScrollView::eventFilter () from /usr/lib/libqt-mt.so.3
---Type <return> to continue, or q <return> to quit---
#2084 0xb713edb8 in QListView::eventFilter () from /usr/lib/libqt-mt.so.3
#2085 0xb7058e4e in QObject::activate_filters () from /usr/lib/libqt-mt.so.3
#2086 0xb7058d7c in QObject::event () from /usr/lib/libqt-mt.so.3
#2087 0xb70915ff in QWidget::event () from /usr/lib/libqt-mt.so.3
#2088 0xb6ffebbf in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#2089 0xb6ffe2b4 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#2090 0xb76944f0 in KApplication::notify (this=0xbffff710, receiver=0x8519220, event=0xbffff170)
    at /home/jr/devel/kdelibs/kdecore/kapplication.cpp:543
#2091 0xb6f93630 in QETWidget::translateMouseEvent () from /usr/lib/libqt-mt.so.3
#2092 0xb6f912be in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#2093 0xb6fa8194 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#2094 0xb7010f18 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#2095 0xb7010dc8 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#2096 0xb6ffee11 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#2097 0x081664ad in main (argc=1, argv=0xbffff8b4) at /home/jr/devel/kdesdk/umbrello/umbrello/main.cpp:91
Comment 3 Jonathan Riddell 2005-01-09 04:37:59 UTC
This doesn't happen every time, I had to drag the class into and out of the package a few times for it to happen.
Comment 4 Oliver Kellogg 2005-01-09 20:32:58 UTC
CVS commit by okellogg: 

moveObject(): Add missing m_doc->addUMLObject() when new parent is the
Logical View.  I am stunned that this could go unnoticed for so long!
Thanks to Jonathan for the backtrace which helped pinpoint the problem.
BUG:95954


  M +1 -1      ChangeLog   1.57
  M +17 -4     umbrello/umllistview.cpp   1.143


--- kdesdk/umbrello/ChangeLog  #1.56:1.57
@@ -23,5 +23,5 @@
 91433 91434 91494 91869 91922 92116 92123 92222 92300 92301
 92781 92995 93122 93219 93297 93501 93595 93696 94173 94728
-94795 94883 95082 95252 95722 95924 95951 96216 96221
+94795 94883 95082 95252 95722 95924 95951 95954 96216 96221
 
 Version 1.3

--- kdesdk/umbrello/umbrello/umllistview.cpp  #1.142:1.143
@@ -1056,11 +1056,24 @@ UMLListViewItem * UMLListView::moveObjec
                 return NULL;
 
+        UMLObject *newParentObj = NULL;
         // Remove the source object at the old parent package.
         UMLObject *srcObj = m_doc->findObjectById(srcId);
         if (srcObj) {
+                newParentObj = newParent->getUMLObject();
+                if (srcObj == newParentObj) {
+                        kdError() << "UMLListView::moveObject(" << srcObj->getName()
+                                  << "): Cannot move onto self" << endl;
+                        return NULL;
+                }
                 UMLPackage *srcPkg = srcObj->getUMLPackage();
-                if (srcPkg)
+                if (srcPkg) {
+                        if (srcPkg == newParentObj) {
+                                kdError() << "UMLListView::moveObject(" << srcObj->getName()
+                                          << "): Object is already in target package" << endl;
+                                return NULL;
+                        }
                         srcPkg->removeObject(srcObj);
         }
+        }
 
         Uml::ListView_Type newParentType = newParent->getType();
@@ -1140,10 +1153,10 @@ UMLListViewItem * UMLListView::moveObjec
                                            newParentType == Uml::lvt_Interface ||
                                            newParentType == Uml::lvt_Class) {
-                                        UMLPackage *pkg = static_cast<UMLPackage*>(
-                                                           newParent->getUMLObject() );
+                                        UMLPackage *pkg = static_cast<UMLPackage*>(newParentObj);
                                         o->setUMLPackage( pkg );
                                         pkg->addObject( o );
                                 } else {
                                         o->setUMLPackage( NULL );
+                                        m_doc->addUMLObject( o );
                                 }
                         }
@@ -1159,5 +1172,5 @@ void UMLListView::slotDropped(QDropEvent
                 //kdDebug() << "UMLListView::slotDropped: item is NULL - setting to currentItem()"
                 //        << endl;
-                item = (UMLListViewItem *)currentItem();
+                item = currentItem();
         }
         UMLDrag::LvTypeAndID_List srcList;