SButton OnClicked compiles but crashes

I have a really basic SButton defined in my plugin user interface, which calls a member function when clicked.
The project compiles without error but as soon as I access the editor plugin in UE4, the engine crashes.

At the moment I just want the button to return, and I cant even get it to do that ha! If I comment out the .OnClicked attribute then the project compiles and the editor plugin can be interacted with (though the button does nothing of course).

edit Additionally the Crash Reporter reports “No minidump found for this crash”
edit submitted the crash report, MachineId:F74ED15B4909333BB3F9C9841C7DD770

Any help?

header

class FVASFVPluginEdModeToolkit : public FModeToolkit
{
public:
    FVASFVPluginEdModeToolkit();

    FReply GetPercentage();
};

cpp

FVASFVPluginEdModeToolkit::FVASFVPluginEdModeToolkit()
{
    //rest of the UI code
    SNew(SButton)
    .Text(FText::FromString("Log Percentage"))
    .OnClicked(this, &FVASFVPluginEdModeToolkit::GetPercentage)
    //rest of the UI code
}
...
FReply FVASFVPluginEdModeToolkit::GetPercentage()
{	
    //do something
    return FReply::Handled();
}

Crash Log

[2016.03.11-15.45.17:425][422]LogWindows:Error: Windows GetLastError: The operation completed successfully. (0)
[2016.03.11-15.45.17:657][422]LogCrashTracker: 


[2016.03.11-15.45.17:658][422]LogCrashTracker: 


[2016.03.11-15.45.17:658][422]LogWindows:Error: === Critical error: ===
Assertion failed: SharedThis.Get() == this [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.10\Engine\Source\Runtime\Core\Public\Templates\SharedPointer.h] [Line: 1093]

Hey Jayae-

Are you able to reproduce the crash in a new project? If so can you list the steps to reproduce it? Was your plugin created manually or through the New Plugin wizard in the editor? If you used the editor to create the plugin, what template did you use for the plugin? Be sure to include as much information in your reproduction steps as possible.

Cheers

Hi

My steps to reproduce:

  1. Create new blank c++ project and use the plugin wizard to create a new editor mode plugin called CleanPlugin

  2. Restart and rebuild as directed

  3. Load the project in VS2015

  4. In CleanPluginEdModeToolkit.cpp, change IsWidgetEnabled() to return true;

  5. Add to CleanPluginEdModeToolkit.cpp:

    FReply FCleanPluginEdModeToolkit::ReturnSimple() const
    {
    return FReply::Handled();
    }

  6. Add to CleanPluginEdModeToolkit.cpp, just before the end of the UI setup:

    • SVerticalBox::Slot()
      .HAlign(HAlign_Center)
      .AutoHeight()
      [
      SNew(SButton)
      .Text(FText::FromString(“Test Button”))
      ]
  7. Add to CleanPluginEdModeToolkit.h under the existing constructor::

    FReply ReturnSimple() const;

  8. Build project. This compiles, and plugin can be accessed and the test button clicked on.

  9. Change the SNew(SButton) to:

    SNew(SButton)
    .Text(FText::FromString(“Test Button”))
    .OnClicked(this, &FCleanPluginEdModeToolkit::ReturnSimple)

This is syntactically the same as SButton examples in SWidgetGallery.cpp and STestSuite.cpp

  1. Build project. This compiles, but editor crashes as soon as trying to access the editor plugin. No minidump found.

MachineId:F74ED15B4909333BB3F9C9841C7DD770, I just submitted the crash report again from this reproduction.

Thanks for checking!

Hey Jayae-

Thank you for the reproduction steps. Using them I was able to reproduce the crash and have entered a bug report (UE-28456) for further investigation.

Cheers

Hi

Has anyone been able to look at this bug report yet? I’m keen to know whether the error is my C++ code or not.

This is still open and waiting further investigation. I can update you here once there is more information on the bug report.