ImpulseAdventure / GUIslice-Builder

Cross-platform drag & drop GUI builder for GUIslice
Other
167 stars 35 forks source link

Fatal error when pasting invalid referenced element #53

Closed knyipab closed 4 years ago

knyipab commented 4 years ago

I guess this bug is somehow related to #52 (cuz perhaps selection on tree view gives an invalid reference when copying to clipboard). But this issues extends to the following two scenarios:

  1. copy any element, close the project, reopen/new a project, and then paste
  2. create an element, copy that element, press undo (to undo the creation), and then paste

I think the builder handle copy-paste by "shallow copy" which is implemented by Java reference or a pointer on memory level. Copy-close-open-paste & Copy-undo-paste both store an invalid reference in clipboard.

Putting a "try ... catch" should fix the bug and at least the builder won't crash with the project unsaved.

Pconti31 commented 4 years ago

assigned bug 129. Paul--

Pconti31 commented 4 years ago

bug 129 will be fixed in 0.13.b011.

testing option one doesn't reproduce unless you use ^c in the treeview(which causes an empty clipboard and a null exception inside paste), using copy button seems fine. So unless you can give me a reproducible case I'll assume this is a non-problem since ^c is addressed by another bug report.

option two is caused by my undo incorrectly clearing the clipboard using a generic data transfer object set to null instead of my WidgetItemsSelection set to null causing the type violation. And No I don't use shallow copy.

I store the copied objects inside a CopyCommand instance and place a data transfer object on a local clipboard. As you may know java supports two types of clipboard, system (os dependent) and only for text, I use this in the property tables so you can cut and paste text from other programs using ^c and ^v into text fields, However, copy,cut,paste buttons are not supported for text mostly because I can't figure out a way to make that work.

While I keep java objects inside what java calls a local clipboard, of which you can have many simply by naming them. I however only use one and its kept inside the Controller object. Paul--

knyipab commented 4 years ago

I think you are right, option one probably duplicates with the ^c problem in another bug report. Once the program is closed, nothing is stored in the local clipboard. Option one occurs just because clipboard is null after program reopen and it doesn't check if null before execute a paste.

Pconti31 commented 4 years ago

fixed in release 0.13.b011