Skip to content

Commit

Permalink
Memory fre fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1maker committed Sep 9, 2024
1 parent 99f29f5 commit 1689fd3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion NGTScript/NGTScript.vcxproj.user
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>"D:\projects\Avoid the shit\avoid_the_shit.ngt" -d</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>"D:\projects\ngt\Tests\tts_voice.ngt" -d</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>D:\projects\Avoid the shit</LocalDebuggerWorkingDirectory>
</PropertyGroup>
Expand Down
5 changes: 1 addition & 4 deletions NGTScript/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ asIScriptModule* Compile(asIScriptEngine* engine, const char* inputFile)
return nullptr;
}

result = module->SaveByteCode(&stream, false);
result = module->SaveByteCode(&stream, true);
if (result < 0)
{
engine->WriteMessage(inputFile, 0, 0, asMSGTYPE_ERROR, "Failed to write the bytecode");
Expand Down Expand Up @@ -386,10 +386,7 @@ auto main(int argc, char* argv[]) -> int {
}
else {
if (argc < 2) {
show_console();
engine->WriteMessage(get_exe().c_str(), 0, 0, asMSGTYPE_INFORMATION, "Something went wrong when starting the engine.\r\nNothing to debug, nothing to compile.\r\nArguments and flags that can be used:\r\n\"NGTScript.exe <filename> -d\" - Debug a script.\r\n\"NGTScript.exe <filename> -c\" - Compile a script to executable file.\r\n\"NGTScript.exe <output file> -i\" - Write engine config to a file.");
ExecSystemCmd("pause");
hide_console();
return -1;
}

Expand Down
5 changes: 2 additions & 3 deletions NGTScript/ngt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,15 +646,14 @@ void exit_engine(int return_number)
e_ctx->Release();
exit_callback = nullptr;
}
if (ctx != nullptr)
ctx->Release();
soundsystem_free();
hide_window();
enet_deinitialize();
SRAL_UnregisterKeyboardHooks();
SRAL_Uninitialize();
SDL_Quit();
std::exit(0);
if (ctx != nullptr)ctx->Abort();
std::exit(return_number);
}
CScriptArray* keys_pressed() {
asIScriptContext* ctx = asGetActiveContext();
Expand Down
1 change: 0 additions & 1 deletion NGTScript/ngt.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Copyright (c) 2011 rubicon IT GmbH
#ifndef NGT_H
#define NGT_H
#pragma once
Expand Down
5 changes: 5 additions & 0 deletions tests/runtime_error.ngt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
array<char> a;
int main(){
a[5000];
return 0;
}

0 comments on commit 1689fd3

Please sign in to comment.