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 occured when invoke AddToRoot and AddToViewport at one time

code to reproduce issue:

 UUserWidget* Widget = CreateWidget<UUserWidget>(MyPlayerController, WidgetTemplate);
 if (Widget)
 {
     Widget->AddToRoot();
     Widget->AddToViewport();
 }

If invoke AddToRoot and AddToViewport at the same time, UE4Editor would crash when click Stop button of Editor at runtime.

crash dump:

 Assertion failed: !IsRooted() [File:d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\coreuobject\public\uobject\UObjectBaseUtility.h] [Line: 135] 
 
 
 
 UE4Editor_Core!FDebug::AssertFailed() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\core\private\misc\outputdevice.cpp:421]
 UE4Editor_UnrealEd!<lambda_26419e543909ee92ebfb672b1e9c08dc>::operator()() [d:\build\++ue4+release-4.13+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:384]
 UE4Editor_CoreUObject!ForEachObjectWithOuter() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjecthash.cpp:678]
 UE4Editor_UnrealEd!UEditorEngine::EndPlayMap() [d:\build\++ue4+release-4.13+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:380]
 UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\build\++ue4+release-4.13+compile\sync\engine\source\editor\unrealed\private\editorengine.cpp:1653]
 UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\build\++ue4+release-4.13+compile\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:371]
 UE4Editor!FEngineLoop::Tick() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:2834]
 UE4Editor!GuardedMain() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\launch\private\launch.cpp:156]
 UE4Editor!GuardedMainWrapper() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
 UE4Editor!WinMain() [d:\build\++ue4+release-4.13+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
 UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
 kernel32
 ntdll

I think UE4 should prevent users to invoke AddToRoot and AddToViewport at the same time, or give an exact tip to warn users from that usage.

Product Version: UE 4.13
Tags:
more ▼

asked Oct 18 '16 at 04:21 PM in C++ Programming

avatar image

笑傲江湖-DA
216 12 24 30

avatar image Doug E ♦♦ STAFF Oct 18 '16 at 04:46 PM

Hello,

Where are you adding/calling this code? Is this happening inside an actor class, or in a begin play function, or a function being called later during runtime. Please include additional details to help me reproduce / investigate the behavior you're seeing.

avatar image 笑傲江湖-DA Oct 18 '16 at 05:30 PM

Hello, Doug Wilson. I call it in a Widget Button click event in a custom UUserWidget class. and I have several UUserWidget* need to create in my app.

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

1 answer: sort voted first

The reason the editor is crashing on exit is because "Widget" is not being cleaned up when the object it is being added to is destroyed. Adding a call to Widget->RemoveFromRoot(); at any point before the object is destroyed should prevent the editor from crashing on exit.

Cheers

Doug Wilson

more ▼

answered Oct 18 '16 at 06:40 PM

avatar image 笑傲江湖-DA Oct 19 '16 at 06:10 AM

Oh, I see, it's my wrong. Ty so much!

avatar image 笑傲江湖-DA Oct 19 '16 at 10:06 AM

Execuse me, I have another question, how can I get the event of Stop button of UE4Editor, this crash happens before the BeginDestroy of GameMode and UserWidget.

avatar image 笑傲江湖-DA Oct 19 '16 at 10:38 AM

Oh, I see, Event of Stop button of Editor is MyGameInstance::Shutdown(), not in GameMode.

(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