Crash at Make2D command (problem with Rhino.DocObjects.Custom.UserData?)

It seems Rhino crashes when the user calls the Make2D command in case a plugin stored user data into the camera which was used during Make2D.

I was checking our data handling but it seems it is a general issue. I have attached a sample file to reproduce the problem.

Here is the sample .cs file:
https://www.dropbox.com/s/l6ekagvmmcxmjd6/Make2DCrasher.cs?dl=0

Here is the sample scene file:
https://www.dropbox.com/s/9eio2lnm1l2tyay/chair_noData.3dm?dl=0

To trigger the crash:

  1. Open Rhino
  2. Load the sample file
  3. while the Perspective view is still the active run command “Make2DCrasher”
  4. rectangle-select the chair inside the perspective view
  5. run command Make2D (with default values and on the Perspective view)
    Crash…

It seems in case I select the chair after calling the Make2D command it sometimes doesn’t crash. But if I select the chair before the Make2D command call it is quite sure it crashes on my computer.

Edit:
I have tested mainly under WIN, but it crashes under OSX too.
Here is the OSX crash log, maybe it helps:
Rhinoceros_2020-01-28-094402_MacBook-Pro.crash.zip (39.5 KB)

This is not the crashing thread but maybe it seems it has some connection to user datas:

Thread 2:: Finalizer
0 libc++abi.dylib 0x00007fff6bc353d8 __dynamic_cast + 26
1 com.mcneel.rhinoceros.RhCommon 0x00000001386651dc CRhCmnUserData_Delete + 41
2 ??? 0x000000015cff56dc 0 + 5855205084

Márton

Hi @marton.parlagh,

I’ll have a look at this.

– Dale

Thank you!

M

HI @marton.parlagh,

I am able to repeat the crash using Rhino 6 for Windows. I’ll start an issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-56767

Quick note: UserData.OnDuplicate is like a copy constructor. Thus, you will want to copy source into this.

– Dale

Quick note: UserData.OnDuplicate is like a copy constructor. Thus, you will want to copy source into this .

I am not sure I correctly understand this. Something is wrong with my OnDuplicate implementation?

In “Data” I use only simple types.

Márton

RH-56767 is fixed in the latest Service Release Candidate

Thanks!

Márton