[Plugin] Http/s REST, blueprintable JSON and Parse REST API manager at once (VaRest)

Hi ,
I’ve found bug.
When I call multiple times “Process URL” on the same JSON Request Object I receive error:


2015.01.25-17.34.49:197][235]LogWindows: === Critical error: ===
Fatal error!

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0xffffffff

UE4Editor-VaRestPlugin.dll!UVaRestJsonObject::Reset() (0x00007ffd357c1664) + 36 bytes [e:\biblioteka\dokumenty\unreal projects\gamednastudio\chasingrobbers\plugins\varest\source\varestplugin\private\json\varestjsonobject.cpp:23]
UE4Editor-VaRestPlugin.dll!UVaRestRequestJSON::ResetResponseData() (0x00007ffd357cf2d7) + 0 bytes [e:\biblioteka\dokumenty\unreal projects\gamednastudio\chasingrobbers\plugins\varest\source\varestplugin\private\json\varestrequestjson.cpp:109]
UE4Editor-VaRestPlugin.dll!UVaRestRequestJSON::OnProcessRequestComplete() (0x00007ffd357cd36d) + 0 bytes [e:\biblioteka\dokumenty\unreal projects\gamednastudio\chasingrobbers\plugins\varest\source\varestplugin\private\json\varestrequestjson.cpp:246]
UE4Editor-VaRestPlugin.dll!TBaseUObjectMethodDelegateInstance<0,UVaRestRequestJSON,TTypeWrapper<void> __cdecl(TSharedPtr<IHttpRequest,0>,TSharedPtr<IHttpResponse,1>,bool)>::Execute() (0x00007ffd357cc17a) + 73 bytes [d:\epic games\4.6.1\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:656]
UE4Editor-VaRestPlugin.dll!TBaseUObjectMethodDelegateInstance<0,UVaRestRequestJSON,void __cdecl(TSharedPtr<IHttpRequest,0>,TSharedPtr<IHttpResponse,1>,bool)>::ExecuteIfSafe() (0x00007ffd357cc306) + 71 bytes [d:\epic games\4.6.1\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:737]
UE4Editor-HTTP.dll!TBaseDelegate<void,TSharedPtr<IHttpRequest,0>,TSharedPtr<IHttpResponse,1>,bool>::ExecuteIfBound() (0x00007ffd3571ddee) + 72 bytes [d:\epic games\4.6.1\engine\source\runtime\core\public\delegates\delegatesignatureimpl_variadics.inl:507]
UE4Editor-HTTP.dll!FHttpRequestWinInet::FinishedRequest() (0x00007ffd3571efac) + 78 bytes [d:\epic games\4.6.1\engine\source\runtime\online\http\private\windows\httpwininet.cpp:666]
UE4Editor-HTTP.dll!FHttpRequestWinInet::Tick() (0x00007ffd3572d8cf) + 0 bytes [d:\epic games\4.6.1\engine\source\runtime\online\http\private\windows\httpwininet.cpp:783]
UE4Editor-HTTP.dll!FHttpManager::Tick() (0x00007ffd3572d48f) + 12 bytes [d:\epic games\4.6.1\engine\source\runtime\online\http\private\httpmodule.cpp:152]
UE4Editor.exe!FTicker::Tick() (0x00007ff7f6fee757) + 32 bytes [d:\epic games\4.6.1\engine\source\runtime\core\public\containers	icker.h:78]
UE4Editor.exe!FEngineLoop::Tick() (0x00007ff7f6fede8c) + 0 bytes [d:\epic games\4.6.1\engine\source\runtime\launch\private\launchengineloop.cpp:2307]
UE4Editor.exe!GuardedMain() (0x00007ff7f6fe1afe) + 0 bytes [d:\epic games\4.6.1\engine\source\runtime\launch\private\launch.cpp:131]
UE4Editor.exe!GuardedMainWrapper() (0x00007ff7f6fe1b6a) + 5 bytes [d:\epic games\4.6.1\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor.exe!WinMain() (0x00007ff7f6feecd9) + 17 bytes [d:\epic games\4.6.1\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
UE4Editor.exe!__tmainCRTStartup() (0x00007ff7f6fefca9) + 21 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]
KERNEL32.DLL!UnknownFunction (0x00007ffd6b9416ad) + 0 bytes [UnknownFile:0]
ntdll.dll!UnknownFunction (0x00007ffd6d964409) + 0 bytes [UnknownFile:0]
ntdll.dll!UnknownFunction (0x00007ffd6d964409) + 0 bytes [UnknownFile:0]

It’s probably because of 102 line in VaRestRequestJSON.cpp:


void UVaRestRequestJSON::ResetResponseData()
{
	if (ResponseJsonObj != NULL)
	{
		ResponseJsonObj->Reset();
	}
	else
	{
		ResponseJsonObj = (UVaRestJsonObject*)StaticConstructObject(UVaRestJsonObject::StaticClass());
	}

	bIsValidJsonResponse = false;
}

When I change this to:


void UVaRestRequestJSON::ResetResponseData()
{
	ResponseJsonObj = (UVaRestJsonObject*)StaticConstructObject(UVaRestJsonObject::StaticClass());

	bIsValidJsonResponse = false;
}

it works but I don’t know if this is correct…

, what do you think about that?