Inherit from SDockTab Widget crashes the editor

Hi,

Currently writing a plugin module, I’m encoutering an issue when trying to inherit from SDockTab.

I just created a very simple class that inherit directly from SDockTab:

class SMyEditorDockTab : public SDockTab
{
public:
    SLATE_BEGIN_ARGS(SMyEditorDockTab)
    {}
    SLATE_END_ARGS()

    void Construct(const FArguments& InArgs);
};

I put nothing in the Construct function. This how I add the tab to my blueprintEditor:

TSharedPtr<FTabManager> vTabMgr = vPersonaEditor->GetAssociatedTabManager();

vTabMgr->RegisterTabSpawner(FName("MyTab"), FOnSpawnTab::CreateLambda(
        [](const FSpawnTabArgs&)
        {

            TSharedRef<SDockTab> SpawnedTab
                = SNew(SMyEditorDockTab);

            return SpawnedTab;
        }
    )
    );

//Spawn my docktab.
vTabMgr->InvokeTab(FName("MyTab"));

Spawning this tab will crash the editor. I think I’m missing a construction step of the widget, like calling the base SDockTab::Construct method. Unfortunately, I can’t pass any FArguments as they belong to different classes (cast SMyEditorDockTab ::FArguments to SDockTab::FArguments).

Exception thrown: read access violation.
ImageBrush was 0x678.

This is the callstack:

UE4Editor-Slate.dll!SImage::ComputeDesiredSize(float __formal) Line 64	C++
UE4Editor-SlateCore.dll!SWidget::CacheDesiredSize(float LayoutScaleMultiplier) Line 397	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-SlateCore.dll!SWidget::SlatePrepass(float LayoutScaleMultiplier) Line 385	C++
UE4Editor-Slate.dll!PrepassWindowAndChildren(TSharedRef<SWindow,0> WindowToPrepass) Line 1095	C++
UE4Editor-Slate.dll!PrepassWindowAndChildren(TSharedRef<SWindow,0> WindowToPrepass) Line 1104	C++
UE4Editor-Slate.dll!PrepassWindowAndChildren(TSharedRef<SWindow,0> WindowToPrepass) Line 1104	C++
UE4Editor-Slate.dll!FSlateApplication::DrawPrepass(TSharedPtr<SWindow,0> DrawOnlyThisWindow) Line 1143	C++
UE4Editor-Slate.dll!FSlateApplication::PrivateDrawWindows(TSharedPtr<SWindow,0> DrawOnlyThisWindow) Line 1185	C++
UE4Editor-Slate.dll!FSlateApplication::DrawWindows() Line 957	C++
UE4Editor-Slate.dll!FSlateApplication::TickApplication(float DeltaTime) Line 1543	C++
UE4Editor-Slate.dll!FSlateApplication::Tick() Line 1335	C++
UE4Editor.exe!FEngineLoop::Tick() Line 2679	C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 142	C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 189	C++

Did you ever fix that?

Actually yes, the solution was to create an FArguments object, fill all the fields required by SDockTab (just open the SDockTab source file of the engine, and look at the Construct method) and call the Construct method of the parent class (SDockTab::Construct if I remember well). Since then the engine shouldn’t hang anymore…