ldtk icon indicating copy to clipboard operation
ldtk copied to clipboard

[bug] [crash] Undo and auto link causes dangling backpointer

Open PoolloverNathan opened this issue 3 years ago • 0 comments

Undoing an entity with an autolinkable field will cause the field to still automatically link to the next entity placed. The deleted entity can be selected with the References to this entity field, where deleting (and potentially other operations) will summon the ghost of doom.

Steps to Reproduce

  1. Create an entity.
  2. Add an entity reference. Its default configuration can trigger this bug.
  3. Add an entity layer if necessary.
  4. Place the entity.
  5. Change your mind and undo with CtrlZ.
    → 🐛 The linking ribbon stays connected to the deleted entity.
  6. Place the entity somewhere else.
  7. Defocus and refocus the entity. (due to another bug)
  8. Click the first backlink beside References to this entity.
  9. Delete the entity. → 🛑 You can't delete something that doesn't exist, so the ghost of doom appears instead.

Expected Behavior

The linking ribbon gets detached after step 5.

Actual Behavior

The linking ribbon stays connected to the deleted entity, leading to the crash in step 10.

Error infos

Stack:

LDtk version: 1.1.3-64bits
Unknown instance Instance<Test>@256,144
Error

Processes:

#0 App
 |--- #3 page.Editor
       |--- #4 misc.FileWatcher
       |--- #5 display.WorldRender
       |--- #6 display.LevelRender
       |--- #7 display.Camera
       |--- #8 display.Rulers[--]
       |--- #9 tool.SelectionTool[--]
       |--- #10 tool.lt.DoNothing[--]
       |--- #11 WorldTool
       |--- #12 tool.PanView[--]
       |--- #13 tool.lt.EntityTool[--]
       |--- #50 display.EntityRender
       |--- #51 ui.EntityInstanceEditor
       |--- #52 tool.ResizeTool[--]

Log:

[RENDER]       Rendering world bg...
[FILE]         Reading HTML template entityInstanceEditor from cache
[RENDER]       Rendering world bg...
[FILE]         Reading HTML template entityInstanceEditor from cache
[EVENT]        EntityInstanceChanged 1
[RENDER]       Rendering world bg...
[RENDER]       Rendering world bg...
[FILE]         Reading HTML template entityInstanceEditor from cache
[RENDER]       Rendering world bg...
[RENDER]       Rendering world bg...
[RENDER]       Rendering world bg...
[FILE]         Reading HTML template entityInstanceEditor from cache
[RENDER]       Rendering world bg...
[FILE]         Reading HTML template entityInstanceEditor from cache
[RENDER]       Rendering world bg...
[FILE]         Loading HTML template valuePicker
[RENDER]       Rendering world bg...
[FILE]         Reading HTML template entityInstanceEditor from cache
[RENDER]       Rendering world bg...
[FILE]         Reading HTML template entityInstanceEditor from cache
[RENDER]       Rendering world bg...
[EVENT]        EntityInstanceChanged 1
[RENDER]       Rendering world bg...
[EVENT]        EntityInstanceChanged 1
[RENDER]       Rendering world bg...
[EVENT]        EntityInstanceChanged 1
[RENDER]       Rendering world bg...
[RENDER]       Rendering world bg...
[FILE]         Loading HTML template worldPanel
[FILE]         Loading HTML template levelInstanceForm
[RENDER]       Rendering world level data.Level.Level_0(#0)...
[RENDER]       Rendering world bg...
[EVENT]        LevelSelected 0
[RENDER]       Rendering world level data.Level.Level_0(#0)...
[RENDER]       Rendering world level fields data.Level.Level_0(#0)...
[WARNING]      Full level render requested
[RENDER]       Rendering world bg...
[FILE]         Reading HTML template entityInstanceEditor from cache
[EVENT]        EntityInstanceChanged 1
[RENDER]       Rendering world bg...
[FILE]         Reading HTML template entityInstanceEditor from cache
[RENDER]       Rendering world bg...
[GENERAL]      Page started: page.CrashReport()
[FILE]         Loading page template: crashReport from C:/Users/natha/AppData/Local/Programs/ldtk/resources/app.asar/assets/tpl/pages/crashReport.html
[ERROR]        Unknown instance Instance<Test>@256,144 (Error)
[ERROR]        undefined

[GENERAL]      
#0 App
 |--- #3 page.Editor
       |--- #4 misc.FileWatcher
       |--- #5 display.WorldRender
       |--- #6 display.LevelRender
       |--- #7 display.Camera
       |--- #8 display.Rulers[--]
       |--- #9 tool.SelectionTool[--]
       |--- #10 tool.lt.DoNothing[--]
       |--- #11 WorldTool
       |--- #12 tool.PanView[--]
       |--- #13 tool.lt.EntityTool[--]
       |--- #50 display.EntityRender
       |--- #51 ui.EntityInstanceEditor
       |--- #52 tool.ResizeTool[--]
 |--- #53 page.CrashReport

[FILE]         Cleared all file watches

PoolloverNathan avatar May 23 '22 01:05 PoolloverNathan