mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Compilation with an environment variable SLIC3R_HAS_BROKEN_CROAK set
will force the perl confess / croak called from a C++ code to print an error message and exit. There is a bug in some Strawberry Perl instalations leading to an interpreter hang up and an exit with a reasonable message is better than that.
This commit is contained in:
parent
22ca927f12
commit
eb61373b69
3 changed files with 53 additions and 0 deletions
|
@ -1,3 +1,37 @@
|
|||
#ifdef SLIC3R_HAS_BROKEN_CROAK
|
||||
|
||||
// Some Strawberry Perl builds (mainly the latest 64bit builds) have a broken mechanism
|
||||
// for emiting Perl exception after handling a C++ exception. Perl interpreter
|
||||
// simply hangs. Better to show a message box in that case and stop the application.
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
void confess_at(const char *file, int line, const char *func, const char *format, ...)
|
||||
{
|
||||
char dest[1024*8];
|
||||
va_list argptr;
|
||||
va_start(argptr, format);
|
||||
vsprintf(dest, format, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
strcat(dest, "\r\n Closing the application.\r\n");
|
||||
#ifdef WIN32
|
||||
::MessageBoxA(NULL, dest, "Slic3r Prusa Edition", MB_OK | MB_ICONERROR);
|
||||
#endif;
|
||||
|
||||
// Give up.
|
||||
printf(dest);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <xsinit.h>
|
||||
|
||||
void
|
||||
|
@ -26,3 +60,5 @@ confess_at(const char *file, int line, const char *func,
|
|||
LEAVE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue