Skip to content

Commit

Permalink
+ do not throw exception from inside signal handler to get useful sta…
Browse files Browse the repository at this point in the history
…ck trace for segmentation faults
  • Loading branch information
wwmayer committed Jan 13, 2015
1 parent 7c789a1 commit fa4f8b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/App/Application.cpp
Expand Up @@ -939,30 +939,34 @@ void segmentation_fault_handler(int sig)
switch (sig) {
case SIGSEGV:
std::cerr << "Illegal storage access..." << std::endl;
#if !defined(_DEBUG)
throw Base::Exception("Illegal storage access! Please save your work under a new file name and restart the application!");
#endif
break;
case SIGABRT:
std::cerr << "Abnormal program termination..." << std::endl;
#if !defined(_DEBUG)
throw Base::Exception("Break signal occoured");
#endif
break;
default:
std::cerr << "Unknown error occurred..." << std::endl;
break;
}

}

void my_terminate_handler()
{
std::cerr << "Terminating..." << std::endl;

}

void unexpection_error_handler()
{
std::cerr << "Unexpected error occurred..." << std::endl;
// try to throw to give the user evantually a change to save
#if !defined(_DEBUG)
throw Base::Exception("Unexpected error occurred! Please save your work under a new file name and restart the application!");
#endif

terminate();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Part/App/AppPart.cpp
Expand Up @@ -116,9 +116,9 @@ void PartExport initPart()
// if we have mysterious crashes
// The argument must be 'Standard_False' to avoid FPE caused by
// Python's cmath module.
//#if defined(FC_OS_LINUX)
#if !defined(_DEBUG)
OSD::SetSignal(Standard_False);
//#endif
#endif

PyObject* partModule = Py_InitModule3("Part", Part_methods, module_part_doc); /* mod name, table ptr */
Base::Console().Log("Loading Part module... done\n");
Expand Down

0 comments on commit fa4f8b0

Please sign in to comment.