Bug 327834

Summary: Crash on copy and paste into new file
Product: [Applications] umbrello Reporter: Ralf Habacker <ralf.habacker>
Component: generalAssignee: Joris Steyn <kde>
Status: RESOLVED FIXED    
Severity: crash CC: kde
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 4.12.0
Attachments: xmi file to reproduce the crash
Simplified test case
huge test case

Description Ralf Habacker 2013-11-19 21:29:30 UTC
moved from bug #209552 part b

Reproducible: Always

Steps to Reproduce:
1) Select all 
2) Copy (Control + C) 
3) File -> New 
4) Paste (Control + V) 
5) Right click in a class to add some attribute
Actual Results:  
Umbrello crashes

Expected Results:  
Umbrello should not crash
Comment 1 Ralf Habacker 2013-11-19 21:30:37 UTC
Created attachment 83644 [details]
xmi file to reproduce the crash
Comment 2 Ralf Habacker 2013-11-19 22:09:20 UTC
Created attachment 83645 [details]
Simplified test case

Saving the pasted widgets into a xmi file immediatly after pasting do not contains the association. Seems that the pasted association is not complete created or not connected correctly to the class widgets.
Comment 3 Ralf Habacker 2013-11-19 22:13:01 UTC
Adding attribute or moving classses from the paste simplified test case results into the following crash. 

0	WidgetBase::rect	widgetbase.cpp	590	0x62db50	
1	UMLWidget::width	umlwidget.h	131	0x5ded9f	
2	AssociationWidget::calculateTextPosition	associationwidget.cpp	2476	0x5f0092	
3	AssociationWidget::saveIdealTextPositions	associationwidget.cpp	1851	0x5f057e	
4	UMLWidget::adjustAssocs	umlwidget.cpp	1023	0x6252b0	
5	UMLWidget::updateGeometry	umlwidget.cpp	1501	0x622f12	
6	UMLWidget::updateWidget	umlwidget.cpp	596	0x622f5d	
7	UMLWidget::qt_static_metacall	umlwidget.moc	67	0x6237dc	
8	QMetaObject::activate	qobject.cpp	3556	0x7ffff582d37f	
9	UMLClassifier::addAttribute	classifier.cpp	876	0x63aaa3	
10	UMLClassifier::createAttribute	classifier.cpp	795	0x63ae75	
11	UMLListView::createChildUMLObject	umllistview.cpp	2410	0x6a4110	
12	UMLListView::createItem	umllistview.cpp	2217	0x6a48ac	
13	UMLListView::addNewItem	umllistview.cpp	2131	0x6a54d3	
14	UMLListView::popupMenuSel	umllistview.cpp	489	0x6a58d1	
15	UMLListView::qt_static_metacall	umllistview.moc	91	0x6aaad0	
16	QMetaObject::activate	qobject.cpp	3556	0x7ffff582d37f	
17	QMenu::triggered	moc_qmenu.cpp	177	0x7ffff4dd92c2	
18	QMenuPrivate::activateCausedStack	qmenu.cpp	1048	0x7ffff4dd9490	
19	QMenuPrivate::activateAction	qmenu.cpp	1130	0x7ffff4ddf929	
20	KMenu::mouseReleaseEvent	kmenu.cpp	464	0x7ffff6809ed0	
21	QWidget::event	qwidget.cpp	8376	0x7ffff49f43d9	
22	QMenu::event	qmenu.cpp	2481	0x7ffff4de0bdb	
23	QApplicationPrivate::notify_helper	qapplication.cpp	4562	0x7ffff49a491c	
24	QApplication::notify	qapplication.cpp	4105	0x7ffff49a95fb	
25	KApplication::notify	kapplication.cpp	311	0x7ffff6750e16	
26	QCoreApplication::notifyInternal	qcoreapplication.cpp	949	0x7ffff5817e7e	
27	sendEvent	qcoreapplication.h	231	0x7ffff49a575b	
28	QApplicationPrivate::sendMouseEvent	qapplication.cpp	3173	0x7ffff49a575b	
29	QETWidget::translateMouseEvent	qapplication_x11.cpp	4462	0x7ffff4a1fefc	
30	QApplication::x11ProcessEvent	qapplication_x11.cpp	3651	0x7ffff4a1edc1	
31	x11EventSourceDispatch	qguieventdispatcher_glib.cpp	146	0x7ffff4a45162	
32	g_main_context_dispatch	/usr/lib64/libglib-2.0.so.0		0x7fffeff3f3b5	
33	??	/usr/lib64/libglib-2.0.so.0		0x7fffeff3f6e8	
34	g_main_context_iteration	/usr/lib64/libglib-2.0.so.0		0x7fffeff3f7a4	
35	QEventDispatcherGlib::processEvents	qeventdispatcher_glib.cpp	427	0x7ffff58464f6	
36	QGuiEventDispatcherGlib::processEvents	qguieventdispatcher_glib.cpp	204	0x7ffff4a44dde	
37	QEventLoop::processEvents	qeventloop.cpp	149	0x7ffff5816b2f	
38	QEventLoop::exec	qeventloop.cpp	204	0x7ffff5816db8	
39	QCoreApplication::exec	qcoreapplication.cpp	1221	0x7ffff581baf8	
40	main	main.cpp	113	0x437f92
Comment 4 Ralf Habacker 2013-11-19 23:00:04 UTC
The pasted xmi fragment do not contains the UML:Association. 

umbrello(7931) UMLClipboard::paste: Pasting mimeType= "application/x-uml-clip4" data= "<xmiclip diagramtype="1">
 <umlobjects>
  <UML:Class visibility="public" isSpecification="false" namespace="Logical View" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="dHIfE4TtsSMF" name="neue_klasse"/>
  <UML:Class visibility="public" isSpecification="false" namespace="Logical View" isAbstract="false" isLeaf="false" isRoot="false" xmi.id="cPN2QXpqwQvU" name="neue_klasse_1"/>
 </umlobjects>
 <widgets>
  <classwidget linecolor="none" usesdiagramfillcolor="0" linewidth="0" showoperations="1" textcolor="#000000" usesdiagramusefillcolor="0" showpubliconly="1" showpackage="1" x="-522" showattsigs="601" showstereotype="1" y="-234" showattributes="1" font="Sans Serif,9,-1,0,75,0,0,0,0,0" width="99" isinstance="0" usefillcolor="1" fillcolor="#ffff00" xmi.id="dHIfE4TtsSMF" showscope="1" height="33" showopsigs="601"/>
  <classwidget linecolor="none" usesdiagramfillcolor="0" linewidth="0" showoperations="1" textcolor="#000000" usesdiagramusefillcolor="0" showpubliconly="1" showpackage="1" x="-903" showattsigs="601" showstereotype="1" y="-279" showattributes="1" font="Sans Serif,9,-1,0,75,0,0,0,0,0" width="115" isinstance="0" usefillcolor="1" fillcolor="#ffff00" xmi.id="cPN2QXpqwQvU" showscope="1" height="33" showopsigs="601"/>
 </widgets>
 <associations>
  <assocwidget indexa="1" indexb="1" usesdiagramusefillcolor="0" widgetaid="cPN2QXpqwQvU" usesdiagramfillcolor="0" fillcolor="#ffff00" linecolor="none" totalcounta="2" xmi.id="DR2ThhhlAbea" widgetbid="dHIfE4TtsSMF" totalcountb="2" type="503" textcolor="none" usefillcolor="1" linewidth="none">
   <linepath layout="Polyline">
    <startpoint startx="-788" starty="-246"/>
    <endpoint endx="-522" endy="-234"/>
   </linepath>
  </assocwidget>
 </associations>
 <umllistviewitems/>
</xmiclip>
...
umbrello(7931): cannot find UMLObject  "DR2ThhhlAbea"
Comment 5 Joris Steyn 2013-11-20 15:56:17 UTC
Git commit b76512a7e3d64ff4ed68c44776ee960f1ea09387 by Joris Steyn.
Committed on 20/11/2013 at 15:51.
Pushed by jorissteyn into branch 'master'.

Include association objects in clip4 and load them

M  +6    -0    umbrello/clipboard/umlclipboard.cpp
M  +0    -3    umbrello/clipboard/umldragdata.cpp

http://commits.kde.org/umbrello/b76512a7e3d64ff4ed68c44776ee960f1ea09387
Comment 6 Joris Steyn 2013-11-20 19:28:41 UTC
Git commit 50f5d4eb79c2a5cbf4a0072892ee4b483dfd0323 by Joris Steyn.
Committed on 20/11/2013 at 19:22.
Pushed by jorissteyn into branch 'KDE/4.12'.

Include association objects in clip4 and load them
FIXED-IN: 4.12.0

M  +6    -0    umbrello/clipboard/umlclipboard.cpp
M  +0    -3    umbrello/clipboard/umldragdata.cpp

http://commits.kde.org/umbrello/50f5d4eb79c2a5cbf4a0072892ee4b483dfd0323
Comment 7 Ralf Habacker 2013-11-20 22:33:50 UTC
Created attachment 83668 [details]
huge test case

Still crashing with huge test case. How to reproduce
1. Open huge testcase
2. select  "console" diagram
3. select all
4. copy selected widgets into new umbrello instance
Comment 8 Joris Steyn 2013-11-21 07:36:47 UTC
Git commit 5f06e9ae83946a418231ed6b19ff3a524f72e0ab by Joris Steyn.
Committed on 21/11/2013 at 07:32.
Pushed by jorissteyn into branch 'master'.

Fix integer overflow in associationwidget

M  +3    -3    umbrello/widgets/associationwidget.cpp

http://commits.kde.org/umbrello/5f06e9ae83946a418231ed6b19ff3a524f72e0ab
Comment 9 Ralf Habacker 2013-11-21 08:59:03 UTC
*** Bug 327669 has been marked as a duplicate of this bug. ***