summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ff2c57a)
raw | patch | inline | side by side (parent: ff2c57a)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 5 Jan 2019 15:45:44 +0000 (18:45 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 5 Jan 2019 15:45:44 +0000 (18:45 +0300) |
src/editor/Editor.lpr | patch | blob | history | |
src/editor/f_selectmap.pas | patch | blob | history | |
src/editor/g_resources.pas | patch | blob | history | |
src/engine/e_log.pas | patch | blob | history |
diff --git a/src/editor/Editor.lpr b/src/editor/Editor.lpr
index ccbcb60f5a95cd469fd060445b2d7c62a2f202f0..e5d615625dc332d9094a59823bba66049db33924 100644 (file)
--- a/src/editor/Editor.lpr
+++ b/src/editor/Editor.lpr
{$INCLUDE ../shared/a_modes.inc}
uses
- Forms, Interfaces,
- GL, GLExt,
+ Forms, Interfaces, Dialogs,
+ GL, GLExt, SysUtils,
e_graphics in '../engine/e_graphics.pas',
e_log in '../engine/e_log.pas',
e_textures in '../engine/e_textures.pas',
{$R *.res}
{$ENDIF}
+ type
+ THandlerObject = class (TObject)
+ procedure ExceptionHandler (Sender: TObject; e: Exception);
+ end;
+
+ var
+ H: THandlerObject;
+
+ procedure THandlerObject.ExceptionHandler (Sender: TObject; e: Exception);
+ begin
+ e_WriteStackTrace(e.message);
+ MessageDlg('Unhandled exception: ' + e.message + ' (see Editor.log for more information)', mtError, [mbOK], 0);
+ end;
+
begin
Application.ExceptionDialog := aedOkMessageBox;
+ Application.AddOnExceptionHandler(H.ExceptionHandler, True);
Application.Initialize();
Application.CreateForm(TMainForm, MainForm);
index 8d5eecc654bee87e7eefedca55c69fc99ab46ecb..2d4882dedef40fe543cea07b5fa6808315ad0f53 100644 (file)
for i := 0 to list.Count - 1 do
begin
- writeln('GetMap "' + list.Files[i].path + '" "' + list.Files[i].name + '"');
g_ReadResource(FileName, list.Files[i].path, list.Files[i].name, data, len);
if len >= 3 then
index 6a5dbeedd227e3c8da2cc61bd07e6828342b6028..4d636eeadb9489df3ea81eebed7d85289c7c8495 100644 (file)
begin
len := stream.Size;
GetMem(data, len);
+ ASSERT(data <> nil);
//stream.ReadBuffer(data, len); (* leads to segfault *)
for i := 0 to len - 1 do
data[i] := stream.ReadByte();
begin
len := stream1.Size;
GetMem(data, len);
+ ASSERT(data <> nil);
//stream1.ReadBuffer(data, len); (* leads to segfault *)
for i := 0 to len - 1 do
data[i] := stream1.ReadByte();
diff --git a/src/engine/e_log.pas b/src/engine/e_log.pas
index 2cabc36c176ec27ed5618a1d5d24fe0dab658273..6fdd767af6d017c93fc6909b5dba7c0d141fee79 100644 (file)
--- a/src/engine/e_log.pas
+++ b/src/engine/e_log.pas
procedure e_InitLog(fFileName: String; fWriteMode: TWriteMode);
procedure e_WriteLog(TextLine: String; RecordCategory: TRecordCategory;
WriteTime: Boolean = True);
+procedure e_WriteStackTrace (const msg: AnsiString);
function DecodeIPV4(ip: LongWord): string;
implementation
Close(LogFile);
end;
+{$I-}
+procedure e_WriteStackTrace (const msg: AnsiString);
+ var LogFile: TextFile;
+begin
+ e_WriteLog(msg, TRecordCategory.MSG_FATALERROR);
+
+ Assign(LogFile, FileName);
+ if FileExists(FileName) then
+ Append(LogFile)
+ else
+ Rewrite(LogFile);
+
+ writeln(LogFile, '=====================');
+ DumpExceptionBackTrace(LogFile);
+
+ Close(LogFile);
+end;
+
procedure e_InitLog(fFileName: String; fWriteMode: TWriteMode);
begin
FileName := fFileName;