[Uml-devel] [Bug 95954] Umbrello using 100% of CPU when dragging

Oliver Kellogg okellogg at users.sourceforge.net
Sun Jan 9 11:34:03 UTC 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
        
http://bugs.kde.org/show_bug.cgi?id=95954        
okellogg users sourceforge net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From okellogg users sourceforge net  2005-01-09 20:32 -------
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;




More information about the umbrello-devel mailing list