Inochi2D/inochi-creator

[BUG] Crash when using "Set from mirror" when pairing a node with a part as Flip Pairs

Closed this issue · 2 comments

Validations

  • I have checked for similar bug reports and could not find any.
  • I have tested and confirmed that this is an issue in an official branded build.

Describe the bug

If you pair a part that contains a mesh and a node, when trying to use the "Set from mirror" option that affects the meshed part, the application will crash.

Reproduction

  • Create a new puppet
  • Drag an image
  • Create a node
  • Open the Configure Flip Pairings menu
  • Pair the part 1 and part 2
  • Create a new -1 to 1 Parameter (can be both 2d or 3d)
  • Arm the new Parameter
  • Select one axis point and deform the mesh from the image
  • Right click any axis point and select the Set from mirror option

System Architecture

x86_64

Operating System

Linux

Version

0.8.3

Logs

lldb debugger backtrace (+ file paths)

Click to expand!
* thread #1, name = 'inochi-creator', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x218)
  * frame #0: 0x00000000004e9249 inochi-creator`_D7creator8viewport6common4mesh7IncMesh7mImportMFKS8inochi2d4core8meshdata8MeshDataZv(this=0x00007ffff6b91600, data=0x00000000000001e8) at src/inochi-creator/source/creator/viewport/common/mesh.d:67:9
    frame #1: 0x00000000004e042d inochi-creator`_D7creator8viewport6common4mesh7IncMesh7import_MFKS8inochi2d4core8meshdata8MeshDataZv(this=0x00007ffff6b91600, mesh=<unavailable>) at src/inochi-creator/source/creator/viewport/common/mesh.d:308:9
    frame #2: 0x000000000047e755 inochi-creator`_D7creator8viewport6common4mesh7IncMesh6__ctorMFKS8inochi2d4core8meshdata8MeshDataZCQDeQCzQCtQCpQCn(this=0x00007ffff6b91600, mesh=<unavailable>) at src/inochi-creator/source/creator/viewport/common/mesh.d:302:9
    frame #3: 0x00000000004d7185 inochi-creator`_D7creator5utils9transform18incBindingAutoFlipFC8inochi2d4core5param7binding16ParameterBindingQBvS6inmath6linalg__T6VectorTkVii2ZQokbPAmZv(binding=0x00007ffff6acd1e0, srcBinding=0x00007ffff6b32360, index=Vector!(uint, 2) @ 0x00007fffffffcb78, axis=0, extrapolation=true, selected=0x0000000000000000) at src/inochi-creator/source/creator/utils/transform.d:114:13
    frame #4: 0x000000000050ad02 inochi-creator`_D7creator6panels10parameters15keypointActionsFC8inochi2d4core5param9ParameterACQBgQBaQy7binding16ParameterBindingQBkZv(param=0x00007ffff6acb200, srcBindings=inochi2d.core.param.binding.ParameterBinding[] @ 0x00007fffffffd4a8, targetBindings=inochi2d.core.param.binding.ParameterBinding[] @ 0x00007fffffffd498) at src/inochi-creator/source/creator/panels/parameters.d:406:25
    frame #5: 0x000000000050e7b4 inochi-creator`_D7creator6panels10parameters__T16incParameterViewVbi1ZQxFmC8inochi2d4core5param9ParameterPAyabKAQBmS6inmath6linalg__T6VectorTfVii3ZQoZv(idx=0, param=0x00007ffff6acb200, grabParam=0x00007ffff6abc1f0, canGroup=false, paramArr=<unavailable>, groupColor=Vector!(float, 3) @ 0x00007fffffffd9c0) at src/inochi-creator/source/creator/panels/parameters.d:791:21
    frame #6: 0x000000000050e06f inochi-creator`_D7creator6panels10parameters15ParametersPanel8onUpdateMFZv(this=0x00007ffff6abc180) at src/inochi-creator/source/creator/panels/parameters.d:1076:17
    frame #7: 0x00000000005165d8 inochi-creator`_D7creator6panels5Panel6updateMFZv(this=0x00007ffff6abc180) at src/inochi-creator/source/creator/panels/package.d:121:31
    frame #8: 0x00000000005166e0 inochi-creator`_D7creator6panels15incUpdatePanelsFZv at src/inochi-creator/source/creator/panels/package.d:158:9
    frame #9: 0x00000000006031dc inochi-creator`_D3app9incUpdateFZv at src/inochi-creator/source/app.d:135:13
    frame #10: 0x000000000060313f inochi-creator`D main(args=string[] @ 0x00007fffffffdd90) at src/inochi-creator/source/app.d:97:13
    frame #11: 0x00007ffff79a0b8d libdruntime-ldc-shared.so.103`_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv + 77
    frame #12: 0x00007ffff79a09a3 libdruntime-ldc-shared.so.103`_d_run_main2 + 419
    frame #13: 0x00007ffff79a07ed libdruntime-ldc-shared.so.103`_d_run_main + 157
    frame #14: 0x0000000000603212 inochi-creator`main(argc=1, argv=0x00007fffffffe088) at entrypoint.d:42:17
    frame #15: 0x00007ffff716514a libc.so.6`__libc_start_call_main + 122
    frame #16: 0x00007ffff716520b libc.so.6`__libc_start_main@@GLIBC_2.34 + 139
    frame #17: 0x0000000000473cc5 inochi-creator`_start + 37

Additional Context

This bug was the cause of a crash that was reported in the Discord support channel. Here is a video as reference of the crash.

2024-01-26_00-00-50.mp4

You can get the reference puppet from the video here

This bug is also present in version 0.8.2 and in the latest commit to date in the 0.8 branch (472abc1)

It was reproduced both on Windows 10 and Linux

Another thing I found out while debugging this,

src/inochi-creator/source/creator/utils/transform.d:112 returns null when the meshless node is casted as a Drawable, which causes the crash at
src/inochi-creator/source/creator/utils/transform.d:114

Fixed in v0.8.4