x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

SetRelativeLocation crashing game on exit

I have a UObject that implements FTickableGameObject. At every tick, I take an external static mesh component and call SetRelativeLocation on it.

When I exit the game, it crashes with the following message:

Access violation reading location 0xFFFFFFFFFFFFFFFF.

This happens on line 491 of SceneComponent.cpp:

 if (Parent && !Parent->bWorldToComponentUpdated)

With the stack trace going back to me calling SetRelativeLocation. What kind of check do I need to put around my code to have this crash not happen? Or better yet, is there any way to automatically stop ticking when the game ends?

Product Version: UE 4.14
Tags:
more ▼

asked Jan 02 '17 at 07:39 AM in C++ Programming

avatar image

sgp
166 32 42 56

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

The simplest check of course would be

 if (StaticMeshComp)
 {
      StaticMeshComp->SetRelativeLocation(...);
 }

Let's see if this is enough already. Otherwise write a comment below.

more ▼

answered Jan 03 '17 at 03:18 PM

avatar image

Schadek
198 6 4 12

avatar image sgp Jan 03 '17 at 08:51 PM

Hey, unfortunately this doesn't work. I've also tried checking if the world of the mesh is null since the crash line seems to be about projecting the new transform to the world or something, but they're both valid.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

It looks like you are trying to reference something that is no-longer there. As suggested by Schdek it is worth testing for a NULL reference, but then also check if it is valid

 if (StaticMeshComp && StaticMeshComp->IsValidLowLevel())
 {
     StaticMeshComp->SetRelativeLocation(...);
 }

In your example it looks like StaticMeshComp would be being set to a non-NULL value (0xFFFFFFFFFFFFFFFF) so the test for NULL will pass, as the value isn't NULL. The IsValidLowLevel should check that the reference is valid and whatever it points too checks out.

HTH

more ▼

answered Jan 05 '17 at 08:09 PM

avatar image

LinkoVitch
20 3 3 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question