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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Crash when rapidly adding and removing uwidget from viewport, being called by async line trace

I finished programming an interact system for unreal which uses the async linetrace function to determine if an appropriate actor has been looked at, and then uses the player controller to call the addtoviewport function in a widget class which inherits from UUser widget and is connected to a widget blueprint. This works exactly as expected, when I look at an appropriate actor it adds the text prompt to the screen and when I look away it removes it (I also programmed this functionality, basically the same thing but with removefromviewport). But then I noticed that when I quickly look at an appropriate object and then away over and over at a quick pace, it causes the game to crash stating: Access violation - code c0000005 (first/second chance not available) when calling UE4Editor_UMG!UUserWidget::AddToViewport(). Problem is that all calls from pointers occur after the pointer is check to make sure it is not a nullptr, so this error shouldn't be possible. Does anyone have an idea why this is happening?

Update: I have check and this error still occurs when non-async line trace is called.

Product Version: UE 4.21
Tags:
more ▼

asked Jan 28 '19 at 03:17 AM in C++ Programming

avatar image

Si-Time
11 1

avatar image GaryOderNichts Apr 14 '19 at 07:42 AM

I have the same Problem... I hope there is a workaround for this

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

There is, I worked it out. If you dont declare holding variables as uproperties the trash collector will delete it while it's still in use. Then when that variable is called it crashed it. In this case its the uuserwidget variable

more ▼

answered Apr 14 '19 at 07:51 AM

avatar image

Si-Time
11 1

avatar image GaryOderNichts Apr 14 '19 at 07:55 AM

Thank you very much! Adding UPROPERTY() to my UUserWidget fixed it.

(comments are locked)
10|2000 characters needed characters left
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