hugoattal / ElectronicNodes

Wiring style for blueprint and material editors in the Unreal Engine
99 stars 10 forks source link

Keyboard key press in BP editor crashes the engine #44

Closed avudnez closed 2 years ago

avudnez commented 3 years ago

Describe the bug When editing a blueprint with the plugin enabled, a key press (for example spacebar) will cause a crash.

To Reproduce Steps to reproduce the behavior:

  1. Open a blueprint
  2. In the BP editor, press a keyboard key

Expected behavior The engine doesn't crash.

Environment (please complete the following information):

Additional context Sample callstack in UE 4.26

    UE4Editor-GraphEditor.dll!SGraphPanel::OnKeyDown(struct FGeometry const &,struct FKeyEvent const &) Unknown
>   [Inline Frame] UE4Editor-Slate.dll!FSlateApplication::ProcessKeyDownEvent::__l28::<lambda_974dd60229d5d11aefc6f02ee913bb42>::operator()(const FArrangedWidget &) Line 4329  C++
    UE4Editor-Slate.dll!FEventRouter::Route<FReply,FEventRouter::FBubblePolicy,FKeyEvent,<lambda_974dd60229d5d11aefc6f02ee913bb42>>(FSlateApplication * ThisApplication, FEventRouter::FBubblePolicy RoutingPolicy, FKeyEvent EventCopy, const FSlateApplication::ProcessKeyDownEvent::__l28::<lambda_974dd60229d5d11aefc6f02ee913bb42> & Lambda, ESlateDebuggingInputEvent DebuggingInputEvent) Line 383   C++
    [Inline Frame] UE4Editor-Slate.dll!FEventRouter::RouteAlongFocusPath(FSlateApplication *) Line 351  C++
    UE4Editor-Slate.dll!FSlateApplication::ProcessKeyDownEvent(const FKeyEvent & InKeyEvent) Line 4325  C++
    UE4Editor-Slate.dll!FSlateApplication::OnKeyDown(const int KeyCode, const unsigned int CharacterCode, const bool IsRepeat) Line 4222    C++
    UE4Editor-ApplicationCore.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) Line 2013    C++
    UE4Editor-ApplicationCore.dll!FWindowsApplication::DeferMessage(TSharedPtr<FWindowsWindow,0> & NativeWindow, HWND__ * InHWnd, unsigned int InMessage, unsigned __int64 InWParam, __int64 InLParam, int MouseX, int MouseY, unsigned int RawInputFlags) Line 2642    C++
    UE4Editor-ApplicationCore.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 1046   C++
    UE4Editor-ApplicationCore.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 878    C++
    user32.dll!00007ffe94dde858()   Unknown
    user32.dll!00007ffe94dde299()   Unknown
    [Inline Frame] UE4Editor-ApplicationCore.dll!WinPumpMessages() Line 108 C++
    UE4Editor-ApplicationCore.dll!FWindowsPlatformApplicationMisc::PumpMessages(bool bFromMainLoop) Line 130    C++
    UE4Editor.exe!FEngineLoop::Tick() Line 4748 C++
    [Inline Frame] UE4Editor.exe!EngineTick() Line 62   C++
    UE4Editor.exe!GuardedMain(const wchar_t * CmdLine) Line 169 C++
    UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 257   C++

Sample callstack in UE 5.00

    00000000000001a8()  Unknown
>   [Inline Frame] UnrealEditor-Slate.dll!FSlateApplication::ProcessKeyDownEvent::__l22::<lambda_dac6159b32b81279ed2c2188b7d12859>::operator()(const FArrangedWidget &) Line 4349   C++
    UnrealEditor-Slate.dll!FEventRouter::Route<FReply,FEventRouter::FBubblePolicy,FKeyEvent,<lambda_dac6159b32b81279ed2c2188b7d12859>>(FSlateApplication * ThisApplication, FEventRouter::FBubblePolicy RoutingPolicy, FKeyEvent EventCopy, const FSlateApplication::ProcessKeyDownEvent::__l22::<lambda_dac6159b32b81279ed2c2188b7d12859> & Lambda, ESlateDebuggingInputEvent DebuggingInputEvent) Line 385    C++
    [Inline Frame] UnrealEditor-Slate.dll!FEventRouter::RouteAlongFocusPath(FSlateApplication *) Line 353   C++
    UnrealEditor-Slate.dll!FSlateApplication::ProcessKeyDownEvent(const FKeyEvent & InKeyEvent) Line 4345   C++
    UnrealEditor-Slate.dll!FSlateApplication::OnKeyDown(const int KeyCode, const unsigned int CharacterCode, const bool IsRepeat) Line 4256 C++
    UnrealEditor-ApplicationCore.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) Line 2031 C++
    UnrealEditor-ApplicationCore.dll!FWindowsApplication::DeferMessage(TSharedPtr<FWindowsWindow,0> & NativeWindow, HWND__ * InHWnd, unsigned int InMessage, unsigned __int64 InWParam, __int64 InLParam, int MouseX, int MouseY, unsigned int RawInputFlags) Line 2689 C++
    UnrealEditor-ApplicationCore.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 1872    C++
    UnrealEditor-ApplicationCore.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 896 C++
    user32.dll!00007ffe94dde858()   Unknown
    user32.dll!00007ffe94dde4ee()   Unknown
    InkObj.dll!00007ffdbca77e19()   Unknown
    atlthunk.dll!00007ffe704f10b8() Unknown
    user32.dll!00007ffe94dde858()   Unknown
    user32.dll!00007ffe94dde299()   Unknown
    [Inline Frame] UnrealEditor-ApplicationCore.dll!WinPumpMessages() Line 109  C++
    UnrealEditor-ApplicationCore.dll!FWindowsPlatformApplicationMisc::PumpMessages(bool bFromMainLoop) Line 131 C++
    UnrealEditor.exe!FEngineLoop::Tick() Line 4961  C++
    [Inline Frame] UnrealEditor.exe!EngineTick() Line 62    C++
    UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 171  C++
    UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 257    C++
hugoattal commented 3 years ago

Wow, that's really weird, I'm sorry for this...

Out of curiosity, do you use any other plugin? Do you reproduce if you disable the "Use Hotpatch" feature in Edit/Editor Preferences/Electronic Nodes ?

I'll look into it as soon as possible (in a few hours), thank you for reporting it!

avudnez commented 3 years ago

Thanks for the quick response, I forgot to mention it but disabling HotPatch removes the crash indeed.

hugoattal commented 3 years ago

@avudnez I did not manage to reproduce, neither in 4.26 nor 5.0 😕...

Here are my steps to reproduce:

Is there something I'm missing? Are you using the last version of Electronic Nodes (which is 3.3, you can check in Edit/Plugins). Do you use a custom version of the engine, or some special settings? Could you reproduce on a blank new project with only Electronic Nodes activated?

In any case, I'm really sorry for the crash and I hope to solve this as quick as possible...

avudnez commented 3 years ago

Is there something I'm missing?

I don't think so, it's really easy to reproduce on our end with these steps.

Are you using the last version of Electronic Nodes (which is 3.3, you can check in Edit/Plugins).

Yes, this is on 3.3

Do you use a custom version of the engine, or some special settings?

We have a number of patches and custom plugins, maybe they are interferring with something, or it's related to some setup we have. I'll try to have a reduced test case eventually.

If you have pointers as to how I can try to debug this I'll also take a look.

hugoattal commented 3 years ago

Seeing the call stack, I don't really see what can be done... Maybe I'll just disable the hotpatch by default. Or add to the FAQ that such problem would be solved by disabling it.

Hotpatch can be a bit unstable since it overwrite assembly commands in the RAM during the engine execution, but I did my best to make it as stable as possible and hasn't heard of any bug since a while.

Do you have any plugins that add shortcut in the BP editor? If you have a bit of time to make a minimum crashing test case, that would be awesome to debug it and fix it. But I'd understand if you don't have time or have better things to do. In such case I suggest you just disable the hotpatch feature (it will disable Electronic Nodes on Niagara, Behavior Tree and Control Rig, but you'll keep it Blueprints, Material and Animation).

avudnez commented 3 years ago

We may very well have other plugins adding stuff to the BP editor, but as this is not a blocker for us (we disabled the feature), we're not looking into it right now. We'll keep you posted if anything changes :)