# TWeakObjectPtr is "STALE" when assigned valid Actor

**URL:** <https://forums.unrealengine.com/t/tweakobjectptr-is-stale-when-assigned-valid-actor/438620>\
**Category:** Platform & Builds\
**Tags:** UE4-21, unreal-engine, crash, pointer, bug-report, question\
**Created:** [November 30, 2018, 3:23pm UTC](https://forums.unrealengine.com/t/tweakobjectptr-is-stale-when-assigned-valid-actor/438620 "2018-11-30T15:23:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![undercover](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@undercover](https://forums.unrealengine.com/u/undercover)\
**Post date:** [November 30, 2018, 3:23pm UTC](https://forums.unrealengine.com/t/tweakobjectptr-is-stale-when-assigned-valid-actor/438620/1 "2018-11-30T15:23:50Z")

</div>

Hi!

After upgrading to 4.21 from 4.19 I have a problem with `TWeakObjectPtr` being stale directly after assigned a valid actor?

```
bool bIsValidLowLevel = actor_placed_in_editor->IsValidLowLevel();

	TWeakObjectPtr<AActor> test_pointer; 
	test_pointer = actor_placed_in_editor;

	bool bIsState = test_pointer.IsStale();
	bool bIsValid = test_pointer.IsValid();

```

After the above code is run, the status is

```
bIsValidLowLevel = true

bIsState = false

bIsValid = true

```

However, if I hover over `test_pointer` it says “STALE”. If the pointer is used, e.g. `Cast<ISomeInterface>(test_pointer.Get())`, the game crashes.

Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![Jeff\_A](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jeff\_A](https://forums.unrealengine.com/u/Jeff_A)\
**Post date:** [November 30, 2018, 4:05pm UTC](https://forums.unrealengine.com/t/tweakobjectptr-is-stale-when-assigned-valid-actor/438620/2 "2018-11-30T16:05:24Z")

</div>

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

[https://epicsupport.force.com/unrealengine/s/](https://epicsupport.force.com/unrealengine/s/)

Thanks

---

<div class="post-metadata">

**Author:** ![jeevcat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jeevcat](https://forums.unrealengine.com/u/jeevcat)\
**Post date:** [January 30, 2019, 3:51pm UTC](https://forums.unrealengine.com/t/tweakobjectptr-is-stale-when-assigned-valid-actor/438620/3 "2019-01-30T15:51:35Z")

</div>

I’m also having this issue! I think it might only be related to the UE4.natvis file, which is incorrectly showing STALE or the wrong object.

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [February 5, 2019, 11:10am UTC](https://forums.unrealengine.com/t/tweakobjectptr-is-stale-when-assigned-valid-actor/438620/4 "2019-02-05T11:10:34Z")

</div>

This is _still_ a problem - the visualizers have been broken for ages now.

---

<div class="post-metadata">

**Author:** ![Passionfruit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Passionfruit](https://forums.unrealengine.com/u/Passionfruit)\
**Post date:** [April 11, 2019, 2:56pm UTC](https://forums.unrealengine.com/t/tweakobjectptr-is-stale-when-assigned-valid-actor/438620/5 "2019-04-11T14:56:00Z")

</div>

Would it crash the game i its just visualizers?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_88871814](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_88871814](https://forums.unrealengine.com/u/anonymous_user_88871814)\
**Post date:** [June 27, 2019, 6:19pm UTC](https://forums.unrealengine.com/t/tweakobjectptr-is-stale-when-assigned-valid-actor/438620/6 "2019-06-27T18:19:03Z")

</div>

Yeah, the UE4.natvis file is broken for FWeakObjectPtr and TWeakObjectPtr types. Open UE4.natvis, and replace the visualizer sections for the above mentioned types with the following:

```
<DisplayString Condition="ObjectSerialNumber &lt; 1">nullptr</DisplayString>
<DisplayString Condition="GObjectArrayForDebugVisualizers->Objects[ObjectIndex / 65536][ObjectIndex % 65536].SerialNumber != ObjectSerialNumber">STALE</DisplayString>
<DisplayString>{GObjectArrayForDebugVisualizers->Objects[ObjectIndex / 65536][ObjectIndex % 65536].Object}</DisplayString>
<Expand>
  <ExpandedItem>GObjectArrayForDebugVisualizers->Objects[ObjectIndex / 65536][ObjectIndex % 65536].Object</ExpandedItem>
</Expand>

<DisplayString Condition="ObjectSerialNumber &lt; 1">nullptr</DisplayString>
<DisplayString Condition="GObjectArrayForDebugVisualizers->Objects[ObjectIndex / 65536][ObjectIndex % 65536].SerialNumber != ObjectSerialNumber">STALE</DisplayString>
<DisplayString>{($T1*)GObjectArrayForDebugVisualizers->Objects[ObjectIndex / 65536][ObjectIndex % 65536].Object}</DisplayString>
<Expand>
  <ExpandedItem>($T1*)GObjectArrayForDebugVisualizers->Objects[ObjectIndex / 65536][ObjectIndex % 65536].Object</ExpandedItem>
</Expand>

```

(Basically the number 66560 has to be replaced with 65536, Epic apparently has changed the number of elements per chunk in FChunkedFixedUObjectArray from 65 \* 1024 to 64 \* 1024 .)

---

<div class="post-metadata">

**Author:** ![Brian2524](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Brian2524](https://forums.unrealengine.com/u/Brian2524)\
**Post date:** [April 3, 2022, 5:56am UTC](https://forums.unrealengine.com/t/tweakobjectptr-is-stale-when-assigned-valid-actor/438620/7 "2022-04-03T05:56:24Z")

</div>

Seams like this is fixed in 4.27. Not sure the earliest version it was fixed in though.
