mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
Merge pull request #1923 from stweil/errhandling
Don't trigger a deliberate SIGSEGV for fatal errors in release code
This commit is contained in:
commit
02f9d8d95e
@ -71,7 +71,6 @@ const char *format, ... // special message
|
||||
// %s is needed here so msg is printed correctly!
|
||||
fprintf(stderr, "%s", msg);
|
||||
|
||||
int* p = nullptr;
|
||||
switch (action) {
|
||||
case DBG:
|
||||
case TESSLOG:
|
||||
@ -79,8 +78,12 @@ const char *format, ... // special message
|
||||
case TESSEXIT:
|
||||
//err_exit();
|
||||
case ABORT:
|
||||
#if !defined(NDEBUG)
|
||||
// Create a deliberate segv as the stack trace is more useful that way.
|
||||
if (!*p)
|
||||
// This is done only in debug builds, because the error message
|
||||
// "segmentation fault" confuses most normal users.
|
||||
*reinterpret_cast<int*>(0) = 0;
|
||||
#endif
|
||||
abort();
|
||||
default:
|
||||
BADERRACTION.error ("error", ABORT, nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user