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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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++
 

Product Version: UE 4.11
Tags:
more ▼

asked Dec 02 '16 at 10:36 AM in C++ Programming

avatar image

lpc35
11 1 3 5

avatar image eXi Jan 15 '17 at 05:51 PM

Did you ever fix that?

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

1 answer: sort voted first

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...

more ▼

answered Jan 16 '17 at 07:53 AM

avatar image

lpc35
11 1 3 5

(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