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"

UMaterialInstanceDynamic::Create( causes crash if a NULL MaterialInterface is passed in.

Dear Friends at Epic,

Can you check out UMaterialInstanceDynamic::Create( and make sure it handles being passed in a UMaterialInterface* that is NULL in the correct manner?

I sometimes get a crash on the rendering thread when passing in a NULL material (it was not intentional of course, but when it crashes, it doesn't explain what the problem is at all, in the log)

This is just one more step to be make Engine able to handle CPP user-error without crashing

Thanks!

This

 //Create Highlighted and Active Mat Insts
 if(!VISVALID(ItemHighlightedMatInst))
 {
     ItemHighlightedMatInst     = UMaterialInstanceDynamic::Create(SolusInventoryMaterial_HighlightedItemMaterial,GetWorld());
 }
 
 
 if(!VISVALID(ItemActiveMatInst))
 {
     ItemActiveMatInst         = UMaterialInstanceDynamic::Create(SolusInventoryMaterial_ActiveItemMaterial,GetWorld());
 }

had to become this

 //Create Highlighted and Active Mat Insts
 if(SolusInventoryMaterial_HighlightedItemMaterial)
 {
     if(!VISVALID(ItemHighlightedMatInst))
     {
         ItemHighlightedMatInst     = USolusCore::UMaterialInstanceDynamic::Create(SolusInventoryMaterial_HighlightedItemMaterial,GetWorld());
     }
 }
 if(SolusInventoryMaterial_ActiveItemMaterial)
 {
     if(!VISVALID(ItemActiveMatInst))
     {
         ItemActiveMatInst         = UMaterialInstanceDynamic::Create(SolusInventoryMaterial_ActiveItemMaterial,GetWorld());
     }
 }

Where to Start Looking

The most relevant code is right here (abbreviated for legal reasons)

MaterialInstance.cpp

 void UMaterialInstance::SetParentInternal(UMaterialInterface* NewParent)

My Best Guess at the Issue

In the case when the NewParent is NULL, the InitResources() is still running.

     InitResources();

The overall process should probably exit more cleanly, maybe even in the MaterialInstanceDynamic::Create(, and never running SetParentInternal.

Summary

UMaterialInstanceDynamic::Create( is crashing when the material to make the materian instance dynamic from was NULL

I have experienced reproduceable crashes related to passing in NULL for ::Create( so please check this out

You may have to run the code several times to get the crash, for me it is between 1 and 3 runs of the code during runtime before the crash occurs.

Rama

Product Version: Not Selected
Tags:
more ▼

asked May 13 '14 at 07:26 PM in C++ Programming

avatar image

Rama
10.5k 444 343 1081

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

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