Don't rely on the signal delivered by raise(), as this may cause a bogus

assertion when Qt is compiled in debug mode, and simply directly perform
an emergency cleanup when a shutdown event occurs on Windows.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31029 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2009-08-14 13:19:02 +00:00
parent 33eec90086
commit 0695afbc55
4 changed files with 17 additions and 7 deletions

View File

@ -65,6 +65,10 @@ using ::boost::scoped_ptr;
namespace lyx {
// Keep the linker happy on Windows
void emergencyCleanup()
{}
namespace support {
string itoa(unsigned int i)

View File

@ -34,6 +34,9 @@
using namespace std;
namespace lyx {
void emergencyCleanup();
namespace support {
namespace os {
@ -129,9 +132,7 @@ BOOL terminate_handler(DWORD event)
if (event == CTRL_CLOSE_EVENT
|| event == CTRL_LOGOFF_EVENT
|| event == CTRL_SHUTDOWN_EVENT) {
::raise(SIGTERM);
// Relinquish our time slice.
sleep(0);
lyx::emergencyCleanup();
return TRUE;
}
return FALSE;

View File

@ -26,7 +26,6 @@
#include "support/lassert.h"
#include <csignal>
#include <cstdlib>
#include <vector>
@ -72,6 +71,9 @@
using namespace std;
namespace lyx {
void emergencyCleanup();
namespace support {
namespace os {
@ -86,9 +88,7 @@ BOOL terminate_handler(DWORD event)
if (event == CTRL_CLOSE_EVENT
|| event == CTRL_LOGOFF_EVENT
|| event == CTRL_SHUTDOWN_EVENT) {
::raise(SIGTERM);
// Relinquish our time slice.
Sleep(0);
lyx::emergencyCleanup();
return TRUE;
}
return FALSE;

View File

@ -56,6 +56,11 @@ Messages & getGuiMessages()
}
// Keep the linker happy on Windows
void emergencyCleanup()
{}
string const trim(string const & a, char const * p)
{
// LASSERT(p, /**/);