Page 1 of 1

Meanwhile use Binding Text and TextChanged's EvenToCommand

Posted: 10 Apr 2018, 06:29
by ride_wind
Hi,
<!-- Xaml  -->
<Grid>
	<TextBox Width="100" Height="30" Foreground="White" FontSize="20"
			 Text="{Binding TestText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
			 noesis:EventToCommand.Event="TextChanged"
			 noesis:EventToCommand.Command="{Binding TextBoxChanged}"/>
</Grid>
	
// VM.h
UCLASS(BlueprintType, Blueprintable)
class UTestVM : public UObject
{
	GENERATED_BODY()

public:
	UFUNCTION(BlueprintCallable)
	void Init();

	UFUNCTION()
	void TextBoxChanged(UObject* InParamer);

public:
	UPROPERTY()
	FString TestText;
};

//VM.cpp
#include "TestVM.h"
#include "NoesisFunctionLibrary.h"
#include "GamePlatformModule.h"

void UTestVM::Init()
{
	TestText = TEXT("111");
	UNoesisFunctionLibrary::NotifyChanged(this, FName(TEXT("TestText")));
}

void UTestVM::TextBoxChanged(UObject* InParamer)
{
	UE_LOG(LogPlatform, Display, TEXT("Text: %s"), *TestText);
}
This code can work,
But when I stop play in editor, it will crash
That is the call stack.
>	UE4Editor-CoreUObject-Win64-Debug.dll!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 1158	C++	Symbols loaded.
 	UE4Editor-NoesisRuntime-Win64-Debug.dll!NoesisFunctionWrapper::Execute(Noesis::BaseComponent * Param) Line 953	C++	Symbols loaded.
 	Noesis.dll!000007fec57e2c52()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5907730()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec59078be()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec58ddb22()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec57735c2()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5772818()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec57818cc()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec577225e()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5772e97()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5770fb0()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec578de16()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5789780()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec58099fe()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5804564()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec590dad9()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec57a3376()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5874948()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5823053()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5804e9d()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec577d9e2()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec577d7bc()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec57bb68b()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec57bd17f()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5804e9d()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec57cb5c7()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec57948de()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5798513()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5804e9d()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec580474e()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5802649()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec57bb5d1()	Unknown	No symbols loaded.
 	Noesis.dll!000007fec5804e9d()	Unknown	No symbols loaded.
 	UE4Editor-NoesisRuntime-Win64-Debug.dll!Noesis::Ptr<Noesis::FrameworkElement>::Reset() Line 158	C++	Symbols loaded.
 	UE4Editor-NoesisRuntime-Win64-Debug.dll!UNoesisInstance::TermInstance() Line 469	C++	Symbols loaded.
 	UE4Editor-NoesisRuntime-Win64-Debug.dll!UNoesisInstance::BeginDestroy() Line 512	C++	Symbols loaded.
Unreachable.png
It crash when stop play in editor and the text box is't empty.
I guess the reason is that it will delete TestText value and touch off TextChanged Event when destroying,
But why it touch off TextChanged Event?

Thanks.

Re: Meanwhile use Binding Text and TextChanged's EvenToCommand

Posted: 10 Apr 2018, 09:23
by hcpizzi
Hi,

I've added validation to make sure the UObject is not being destroyed before calling its functions. I'll commit the code to GitHub later today, and will post here again to let you know.

Re: Meanwhile use Binding Text and TextChanged's EvenToCommand

Posted: 10 Apr 2018, 17:38
by hcpizzi
The fix for this is up on GitHub. There's now a test to make sure the Object is not being destroyed before calling any of its functions.

Please also be aware that we no longer ship the Editor binaries for Windows and Mac. We expect them to be built locally. For C++ projects this should be no problem, as the plugin should be built along with the rest of the engine and game. But we have also created Python scripts that take care of building the plugin in case you need them. We've updated the README with the instructions.

Please, let us know if you run into any problems with this change.

Re: Meanwhile use Binding Text and TextChanged's EvenToCommand

Posted: 11 Apr 2018, 12:29
by ride_wind
The fix for this is up on GitHub. There's now a test to make sure the Object is not being destroyed before calling any of its functions.

Please also be aware that we no longer ship the Editor binaries for Windows and Mac. We expect them to be built locally. For C++ projects this should be no problem, as the plugin should be built along with the rest of the engine and game. But we have also created Python scripts that take care of building the plugin in case you need them. We've updated the README with the instructions.

Please, let us know if you run into any problems with this change.
It work well, very thanks.