GetObjectsBeingCustomized returns invalid objects

It appears there is some change with object references inside CustomizeDetails? Previously we would get the object being customized with DetailLayout.GetObjectsBeingCustomized(), but this is now returning invalid objects. Strangely it works fine if you drag out the actor but don’t let go. In other words, drag the actor from the left panel into your scene but keep holding down the mouse button. You can see all the properties displayed correctly, showing the right data. Soon as you release the mouse button though it will crash and the object references that were just working fine will all be invalid.

A snippet of the code causing the problem for point #2:

// Declared in the class
TWeakObjectPtr<AMPCCameraActor> Camera;

// Code in CustomizeDetails()
TArray<TWeakObjectPtr<UObject>> objects;
DetailLayout.GetObjectsBeingCustomized(objects);
Camera = Cast<AMPCCameraActor>(objects[0].Get());
//.....
// Inside omitted slate code...
SNew(STextBlock)
.Text_Lambda([this]()->FText {return FText::FromString(Camera->Job);} )

The Camera object passed into the lambda is valid up until such time as you release the object into the scene then it becomes invalid.

Hello John,

I’m not too familiar with the setup that you are using, and as a result, I have a few questions:

  • Could you please provide the full code that you are using (.h and .cpp files) for your setup?
  • Is this occurring in a clean 4.11 Project, or have you converted up from another version?

Thank you.

Hi Sean,

  1. Can you please provide an email address to send the code to, and I will see if I can get production permission to do so. I will most likely have to yank out the code that interfaces directly with our pipeline, but that code doesn’t have any effect on the error.
  2. Not so much as converted, but this is code for plugins we are suing in 4.9, and I am working on recompiling them all for 4.11. To do that I create a fresh new Blank Code project in 4.11, and then am moving our plugin code over one by one and recompiling and dealing with issues/changes as the occur.

You can send me a PM on the forums with the code. Here is a link to my forum profile: https://forums.unrealengine.com/member.php?160394-Sean-Flint

Thanks Sean.

Just working on getting the code I want to send approved for release and then I will PM it to you.

I’ve gotten the code, and have taken a look at it. I see the CustomizeDetails function, but I don’t see where it is being called. Could you please explain where you are calling this function?

Also, if you are getting a crash, could you provide the Callstack and your crash logs?

Well I don’t call it, the engine does :slight_smile: It is just the requisite function for providing detail panel customization. Am I misunderstanding your question?

Call stack: http://pastebin.com/m69qWuzS

No that was the question. As stated earlier, I’m not too familiar with that function, so I just wanted to clarify where it was being called.

Thank you for providing the callstack. I am currently attempting to reproduce your issue, and I will get back to you once I have information.

Hi Sean, any updates on this? It is one of the main things preventing us from moving forward to 4.11

EDIT: To clarify, not expecting a fix, just wondering you have managed to repro and log it.

Perhaps a bug has been introduced with 4.11 (I’m not using it myself) that is causing this, but regardless I think your code looks a little unsafe. The whole point of using a TWeakObjectPtr is that you know it may become invalid at any time, and by doing so you are able to test for validity. As such I think it would be a good idea to check its validity within the lambda, and just return FText::GetEmpty() if it’s not valid.

I have to say, I’ve probably done similar things in detail customizations myself and haven’t as yet noticed an object getting deleted on me, but that doesn’t necessarily mean such a thing happening as of 4.11 implies an engine bug. It could be, for example, that some change has resulted in the details panel hanging around for one frame after an object gets replaced, before being refreshed with the new object.

I apologize for the delay. I am still working on reproducing the issue on our end. I was having some trouble getting the code to compile, so I was attempting to go through and solve the errors we were seeing.

If after you look into the code as suggested, you happen to find a fix for the issue, please do let us know. In the meantime, I will continue to attempt to reproduce your issue and reply with updates as soon as I can.

Hey ,

That is actually a very good point. I think most likely the bug here, or at least the change, is that in the past the pointer never got invalidated, but now there is a period of transition in which is does become invalid.

My code should definitely be better. This is some of the earliest stuff I wrote and I have learned a lot more about the engine since then. Let me take another look at it and see if I can make it more robust.

I have attempted to reproduce this issue using the code you provided, but I am not able to get the code to compile.

Could you please attempt to reproduce this issue in a clean project, and provide the steps you took or a test project so that we can test this issue on our end?

Hello,

I am marking this topic as resolved for tracking purposes, as we have not heard from you in a few days. If this issue persists, feel free to respond to this thread. For any other issues, please create a new Answerhub topic.

Have a great day