[Bug] 4.4 Preview crashes on OSX when creating StaticMesh asset from brush

Hey Guys,

Just trying 4.4 preview on OSX. Something I do a lot, is create static meshes from BSP brushes in Unreal. Got a crash trying to do that with 4.4 Preview).

Steps to repro:

  1. Launch 4.4 Preview
  2. Create new
  3. When in editor, go to Place | Geometry
  4. Drag box into scene
  5. Go to details for box brush
  6. Under brush settings, clickreveal arrow for more options
  7. Click “Create Static Mesh” button
  8. Crash!

.

Hi TommyBear,

Unfortunately thus far I have been unable to reproduce this on my end. Does this happen with any bsp brushes or specific ones (cylinder, cone, etc)? Can you post your logs and dxdiag so we can have a look at what may be going on? Thank you!

Hi ! As I stated in the body of the report, I am using OSX, so dxdiag is out of the question. I’ll change the title to reflect that also. As for the BSP type, in my steps to reproduce I said I was using the box brush. Thanks!

I’m grabbing the tagged source for 4.4 preview right now, I’ll let you know exactly where it is crashing.

.

Okay call stack first:

Line 5633 in /Engine/Source/Editor/UnrealEd/Private/Editor.cpp:

TSharedPtr RootWindow = FGlobalTabmanager::Get()->GetRootWindow(); <---- RootWindow is NULL!
        		FSlateApplication::Get().AddWindowAsNativeChild(CreateAssetFromActorWindow.ToSharedRef(), RootWindow.ToSharedRef()); <--- BOOM HERE

RootWindow is always coming back with NULL. Happens with the source version, happens in debug editor, development editor etc.

Which then asserts in debug here on Line 616 of /Engine/Source/Runtime/Core/Public/Templates/SharedPointer.h:

	FORCEINLINE TSharedRef< ObjectType, Mode > ToSharedRef() const
	{
 		// If this assert goes off, it means a shared reference was created from a shared pointer that was nullptr.
 		// Shared references are never allowed to be null.  Consider using TSharedPtr instead.
		check( IsValid() );  <---- ASSERT HERE
		return TSharedRef< ObjectType, Mode >( *this );
	}

Of course, in development it just crashes :slight_smile:

.

And here is the cause, line 93 /Engine/Source/Editor/MainFrame/Private/MainFrameModule.cpp:

#if !PLATFORM_MAC // On OS X we don't want Top-Level windows to have a parent, as we don't really support the notion of child windows on that OS
		FGlobalTabmanager::Get()->SetRootWindow(RootWindow);
		FSlateNotificationManager::Get().SetRootWindow(RootWindow);
#endif

This means the FGlobalTabmanager will ALWAYS return NULL, causing the issue mentioned above. The #define, explains why you don’t see this issue on windows.

I’ve added a pull request to master here:

https://github.com/EpicGames/UnrealEngine/pull/322

.

Hi TommyBear,

I was able to successfully reproduce this and have attached this as well as my own findings to a crash report for assessment. I will also mention your pull request in the bug report so we can get this resolved quickly. Thank you and have a great day!

Many thanks, but that’s not a correct fix for this issue. We don’t want RootWindow to be set on Mac. It should be NULL. I just committed a proper fix, it should be on GitHub soon - the code in Editor.cpp should check if RootWindow is valid and, if it’s not, use AddWindow() instead of AddWindowAsNativeChild().

Many thanks ! I now know a little more about the editor windowing! Sorry for jumping to conclusions and thanks for the fix.