[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello/clipboard

Oliver Kellogg okellogg at users.sourceforge.net
Mon Sep 19 14:43:07 UTC 2005


SVN commit 462075 by okellogg:

pasteClip4(): If checkPasteWidgets() returns false then remove any
 associations.
CCBUG:111351 - only CCing not closing as there are multitudinous other
ways to produce similar crashes. Boud?


 M  +15 -5     umlclipboard.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/clipboard/umlclipboard.cpp #462074:462075
@@ -478,6 +478,8 @@
 
     if( diagramType != doc->getCurrentView()->getType() ) {
         if( !checkPasteWidgets(widgets) ) {
+            assocs.setAutoDelete(true);
+            assocs.clear();
             return false;
         }
     }
@@ -636,6 +638,7 @@
 }
 
 bool UMLClipboard::checkPasteWidgets( UMLWidgetList & widgetList ) {
+    bool retval = true;
     UMLWidget * p = 0;
     UMLWidgetListIt it( widgetList );
     while ( ( p = it.current()) != 0 ) {
@@ -645,17 +648,24 @@
             break;
 
         case Uml::wt_Text:
-            if( static_cast<FloatingText *>( p )->
-                    getRole() != Uml::tr_Floating )
-                return false;
+            {
+                FloatingText *ft = static_cast<FloatingText*>(p);
+                if (ft->getRole() != Uml::tr_Floating) {
+                    widgetList.remove(p);
+                    delete ft;
+                    retval = false;
+                }
+            }
             break;
 
         default:
-            return false;
+            widgetList.remove(p);
+            delete p;
+            retval = false;
             break;
         }
     }
-    return true;
+    return retval;
 }
 
 void UMLClipboard::pasteItemAlreadyExists() {




More information about the umbrello-devel mailing list