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"

Access Violation on Editor Close using FSlateGameResources::Set()

Reproduction steps and Error details:

'm getting an Unhandled Exception in MultiCastDelegateBase.h FMulticastDelegateBase::RemoveAll line 82.

 Exception thrown at 0x00007FFF6D190AD6 (UE4Editor-ContentBrowser.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

This specifically only occurs when the editor is run from Visual Studio, play in editor is pressed, wait 2 seconds and then click stop and close the editor (error on editor close). The error does not seem to occur if the dynamic brush fails to load the image.

From my debugging attempt what I've come to assume is that somewhere my code is causing UE's garbage collector to attempt to delete an object twice (the second time failing on that line).

The specific line that seems to be causing the error (error does not occur if this line is not present):

 Style->Set(BrushName, NewDynamicBrush);

Supporting code:

Style is created in SSlateWidget::SetupStyle():

 FSlateStyleRegistry::UnRegisterSlateStyle(StyleName);
 Style = FSlateGameResources::New(StyleName, StylePath, StylePath);
 FSlateStyleRegistry::RegisterSlateStyle(*Style.Get());

Brush is set in SSlateWidget::LoadBrush:

 const FSlateBrush *RequestedBrush;
 FSlateDynamicImageBrush *NewDynamicBrush = new FSlateDynamicImageBrush(BrushPath, BrushSize);
 
 //This is the problem line (below). If NewDynamicBrush is returned and this line is commented out, everything works perfectly!
 
 Style->Set(BrushName, NewDynamicBrush);
 RequestedBrush = Style->GetBrush(BrushName);
 return NewDynamicBrush;

Both functions are called in SSlateWidget::Construct:

 StylePath = FPaths::GameContentDir() / "Slate";
 SetupStyle();
 LoadBrush("SmileyBrush", CreateBrushPath("Smiley", ".png"), FVector2D(200, 200));
 
 ChildSlot
 .VAlign(VAlign_Top)
 .HAlign(HAlign_Center)
 [
     SNew(STextBlock)
     .ShadowColorAndOpacity(FLinearColor::Black)
     .ColorAndOpacity(FLinearColor::Red)
     .ShadowOffset(FIntPoint(-1, 1))
     .Font(FSlateFontInfo("Veranda", 16))
     .Text(LOCTEXT("HelloSlate", "Hello World!"))
 ];

Extra:

I have tested using the brush, which works both directly and when loaded from the FSlateGameResources object (image is loaded correctly and displayed on screen correctly). Using the brush does not affect the unhandled exception.

For more information, I've attached a stripped-down project that can reproduce the problem here: https://www.dropbox.com/s/7auh7d527fv2ngy/SlateTest.zip?dl=0

Product Version: UE 4.10
Tags:
more ▼

asked Dec 29 '15 at 05:53 AM in C++ Programming

avatar image

Griffork_Opaque
54 2 8 13

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

0 answers: sort voted first
Be the first one to answer this question
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