Removed the lamexp_fatal_exit() function.
This commit is contained in:
parent
26ac505329
commit
bdfef0ed1c
@ -113,7 +113,6 @@ bool lamexp_detect_wine(void);
|
||||
bool lamexp_enable_close_button(const QWidget *win, const bool bEnable = true);
|
||||
bool lamexp_exec_shell(const QWidget *win, const QString &url, const bool explore = false);
|
||||
bool lamexp_exec_shell(const QWidget *win, const QString &url, const QString ¶meters, const QString &directory, const bool explore = false);
|
||||
void lamexp_fatal_exit(const char* const errorMessage);
|
||||
void lamexp_finalization(void);
|
||||
unsigned __int64 lamexp_free_diskspace(const QString &path, bool *ok = NULL);
|
||||
void lamexp_free_window_icon(lamexp_icon_t *icon);
|
||||
|
@ -123,78 +123,6 @@ while(0)
|
||||
} \
|
||||
while(0)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CRITICAL SECTION
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
* wrapper for native Win32 critical sections
|
||||
*/
|
||||
class CriticalSection
|
||||
{
|
||||
public:
|
||||
inline CriticalSection(void)
|
||||
{
|
||||
InitializeCriticalSection(&m_win32criticalSection);
|
||||
}
|
||||
|
||||
inline ~CriticalSection(void)
|
||||
{
|
||||
DeleteCriticalSection(&m_win32criticalSection);
|
||||
}
|
||||
|
||||
inline void enter(void)
|
||||
{
|
||||
EnterCriticalSection(&m_win32criticalSection);
|
||||
}
|
||||
|
||||
inline bool tryEnter(void)
|
||||
{
|
||||
return TryEnterCriticalSection(&m_win32criticalSection);
|
||||
}
|
||||
|
||||
inline void leave(void)
|
||||
{
|
||||
LeaveCriticalSection(&m_win32criticalSection);
|
||||
}
|
||||
|
||||
protected:
|
||||
CRITICAL_SECTION m_win32criticalSection;
|
||||
};
|
||||
|
||||
/*
|
||||
* RAII-style critical section locker
|
||||
*/
|
||||
class CSLocker
|
||||
{
|
||||
public:
|
||||
inline CSLocker(CriticalSection &criticalSection)
|
||||
:
|
||||
m_locked(false),
|
||||
m_criticalSection(criticalSection)
|
||||
{
|
||||
m_criticalSection.enter();
|
||||
m_locked = true;
|
||||
}
|
||||
|
||||
inline ~CSLocker(void)
|
||||
{
|
||||
forceUnlock();
|
||||
}
|
||||
|
||||
inline void forceUnlock(void)
|
||||
{
|
||||
if(m_locked)
|
||||
{
|
||||
m_criticalSection.leave();
|
||||
m_locked = false;
|
||||
}
|
||||
}
|
||||
protected:
|
||||
volatile bool m_locked;
|
||||
CriticalSection &m_criticalSection;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// GLOBAL VARS
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -204,10 +132,6 @@ static bool g_lamexp_console_attached = false;
|
||||
|
||||
//Fatal exit flags
|
||||
static volatile bool g_lamexp_fatal_flag = true;
|
||||
static CriticalSection g_lamexp_fatal_lock;
|
||||
|
||||
//Global locks
|
||||
static CriticalSection g_lamexp_message_lock;
|
||||
|
||||
//CLI Arguments
|
||||
static struct
|
||||
@ -452,7 +376,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
||||
return;
|
||||
}
|
||||
|
||||
CSLocker lock(g_lamexp_message_lock);
|
||||
//CSLocker lock(g_lamexp_message_lock); FIXME !!!! FIXME !!!! FIXME !!!! FIXME !!!!
|
||||
|
||||
if(g_lamexp_log_file)
|
||||
{
|
||||
@ -470,8 +394,8 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
||||
|
||||
if((type == QtCriticalMsg) || (type == QtFatalMsg))
|
||||
{
|
||||
lock.forceUnlock();
|
||||
lamexp_fatal_exit(msg);
|
||||
//lock.forceUnlock();
|
||||
MUtils::OS::fatal_exit(MUTILS_WCHR(QString::fromUtf8(msg)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -480,7 +404,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
||||
*/
|
||||
static void lamexp_invalid_param_handler(const wchar_t* exp, const wchar_t* fun, const wchar_t* fil, unsigned int, uintptr_t)
|
||||
{
|
||||
lamexp_fatal_exit("Invalid parameter handler invoked, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Invalid parameter handler invoked, application will exit!");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -489,7 +413,7 @@ static void lamexp_invalid_param_handler(const wchar_t* exp, const wchar_t* fun,
|
||||
static void lamexp_signal_handler(int signal_num)
|
||||
{
|
||||
signal(signal_num, lamexp_signal_handler);
|
||||
lamexp_fatal_exit("Signal handler invoked, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Signal handler invoked, application will exit!");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -497,7 +421,7 @@ static void lamexp_signal_handler(int signal_num)
|
||||
*/
|
||||
static LONG WINAPI lamexp_exception_handler(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
||||
{
|
||||
lamexp_fatal_exit("Unhandeled exception handler invoked, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled exception handler invoked, application will exit!");
|
||||
return LONG_MAX;
|
||||
}
|
||||
|
||||
@ -635,7 +559,7 @@ static unsigned int __stdcall lamexp_debug_thread_proc(LPVOID lpParameter)
|
||||
{
|
||||
if(lamexp_check_for_debugger())
|
||||
{
|
||||
lamexp_fatal_exit("Not a debug build. Please unload debugger and try again!");
|
||||
MUtils::OS::fatal_exit(L"Not a debug build. Please unload debugger and try again!");
|
||||
return 666;
|
||||
}
|
||||
lamexp_sleep(100);
|
||||
@ -649,7 +573,7 @@ static HANDLE lamexp_debug_thread_init()
|
||||
{
|
||||
if(lamexp_check_for_debugger())
|
||||
{
|
||||
lamexp_fatal_exit("Not a debug build. Please unload debugger and try again!");
|
||||
MUtils::OS::fatal_exit(L"Not a debug build. Please unload debugger and try again!");
|
||||
}
|
||||
const uintptr_t h = _beginthreadex(NULL, 0, lamexp_debug_thread_proc, NULL, 0, NULL);
|
||||
return (HANDLE)(h^0xdeadbeef);
|
||||
@ -662,7 +586,7 @@ static bool lamexp_event_filter(void *message, long *result)
|
||||
{
|
||||
if((!(MUTILS_DEBUG)) && lamexp_check_for_debugger())
|
||||
{
|
||||
lamexp_fatal_exit("Not a debug build. Please unload debugger and try again!");
|
||||
MUtils::OS::fatal_exit(L"Not a debug build. Please unload debugger and try again!");
|
||||
}
|
||||
|
||||
switch(reinterpret_cast<MSG*>(message)->message)
|
||||
@ -1849,39 +1773,6 @@ static DWORD WINAPI lamexp_fatal_exit_helper(LPVOID lpParameter)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fatal application exit
|
||||
*/
|
||||
void lamexp_fatal_exit(const char* const errorMessage)
|
||||
{
|
||||
g_lamexp_fatal_lock.enter();
|
||||
|
||||
if(!g_lamexp_fatal_flag)
|
||||
{
|
||||
return; /*prevent recursive invocation*/
|
||||
}
|
||||
|
||||
g_lamexp_fatal_flag = false;
|
||||
|
||||
if(g_main_thread_id != GetCurrentThreadId())
|
||||
{
|
||||
if(HANDLE hThreadMain = OpenThread(THREAD_SUSPEND_RESUME, FALSE, g_main_thread_id))
|
||||
{
|
||||
SuspendThread(hThreadMain); /*stop main thread*/
|
||||
}
|
||||
}
|
||||
|
||||
if(HANDLE hThread = CreateThread(NULL, 0, lamexp_fatal_exit_helper, (LPVOID) errorMessage, 0, NULL))
|
||||
{
|
||||
WaitForSingleObject(hThread, INFINITE);
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
TerminateProcess(GetCurrentProcess(), 666);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize debug thread
|
||||
*/
|
||||
@ -1928,7 +1819,7 @@ extern "C" void _lamexp_global_init_win32(void)
|
||||
{
|
||||
if((!MUTILS_DEBUG) && lamexp_check_for_debugger())
|
||||
{
|
||||
lamexp_fatal_exit("Not a debug build. Please unload debugger and try again!");
|
||||
MUtils::OS::fatal_exit(L"Not a debug build. Please unload debugger and try again!");
|
||||
}
|
||||
|
||||
//Zero *before* constructors are called
|
||||
|
@ -22,6 +22,10 @@
|
||||
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/OSSupport.h>
|
||||
|
||||
//Qt
|
||||
#include <QtGlobal>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -40,7 +44,7 @@ static size_t lamexp_entry_check(void)
|
||||
volatile size_t retVal = 0xA199B5AF;
|
||||
if(g_lamexp_entry_check_flag != 0x8761F64D)
|
||||
{
|
||||
lamexp_fatal_exit("Application initialization has failed, take care!");
|
||||
MUtils::OS::fatal_exit(L"Application initialization has failed, take care!");
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
@ -73,7 +77,7 @@ extern "C" int lamexp_entry_point(void)
|
||||
{
|
||||
if(g_lamexp_entry_check_flag != 0x789E09B2)
|
||||
{
|
||||
lamexp_fatal_exit("Application initialization has failed, take care!");
|
||||
MUtils::OS::fatal_exit(L"Application initialization has failed, take care!");
|
||||
}
|
||||
|
||||
//Call global initialization functions
|
||||
|
@ -242,12 +242,12 @@ static int _main(int argc, char* argv[])
|
||||
catch(const std::exception &error)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
return iResult;
|
||||
}
|
||||
@ -271,7 +271,7 @@ int main(int argc, char* argv[])
|
||||
__except(1)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnhandeled structured exception error!\n");
|
||||
lamexp_fatal_exit("Unhandeled structured exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled structured exception error, application will exit!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,9 +20,14 @@
|
||||
// http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Internal
|
||||
#include "Thread_CPUObserver.h"
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/OSSupport.h>
|
||||
|
||||
//Qt
|
||||
#include <QDir>
|
||||
|
||||
//Windows includes
|
||||
@ -57,12 +62,12 @@ void CPUObserverThread::run(void)
|
||||
catch(const std::exception &error)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
|
||||
while(m_semaphore.available()) m_semaphore.tryAcquire();
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
|
||||
//Qt
|
||||
#include <QDir>
|
||||
@ -63,12 +64,12 @@ void DiskObserverThread::run(void)
|
||||
catch(const std::exception &error)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
|
||||
while(m_semaphore.available()) m_semaphore.tryAcquire();
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
|
||||
//Qt
|
||||
#include <QDir>
|
||||
@ -89,12 +90,12 @@ void AnalyzeTask::run()
|
||||
catch(const std::exception &error)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
|
||||
//Qt
|
||||
#include <QFileInfo>
|
||||
@ -235,12 +236,12 @@ void InitializationThread::run(void)
|
||||
catch(const std::exception &error)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
#include <MUtils/Version.h>
|
||||
|
||||
//Qt
|
||||
@ -187,12 +188,12 @@ void ProcessThread::run()
|
||||
catch(const std::exception &error)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,10 @@
|
||||
#include "Thread_RAMObserver.h"
|
||||
#include "Global.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/OSSupport.h>
|
||||
|
||||
//Qt
|
||||
#include <QDir>
|
||||
|
||||
//Windows includes
|
||||
@ -57,12 +61,12 @@ void RAMObserverThread::run(void)
|
||||
catch(const std::exception &error)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what());
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n");
|
||||
lamexp_fatal_exit("Unhandeled C++ exception error, application will exit!");
|
||||
MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!");
|
||||
}
|
||||
|
||||
while(m_semaphore.available()) m_semaphore.tryAcquire();
|
||||
|
Loading…
Reference in New Issue
Block a user