mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: GCC Leak detection altered
git-svn-id: svn://ultimatepp.org/upp/trunk@9243 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
52d7d98333
commit
9af43ce735
3 changed files with 38 additions and 11 deletions
|
|
@ -317,10 +317,6 @@ class JsonIO;
|
|||
#include "InVector.hpp"
|
||||
#include "InMap.hpp"
|
||||
|
||||
#if (defined(HEAPDBG) || defined(TESTLEAKS)) && defined(PLATFORM_POSIX)
|
||||
extern int sMemDiagInitCount;
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
NTL_MOVEABLE(POINT)
|
||||
NTL_MOVEABLE(SIZE)
|
||||
|
|
@ -329,14 +325,14 @@ NTL_MOVEABLE(RECT)
|
|||
|
||||
END_UPP_NAMESPACE
|
||||
|
||||
#if (defined(TESTLEAKS) || defined(HEAPDBG)) && defined(PLATFORM_POSIX) && !defined(PLATFORM_OSX11) && defined(UPP_HEAP)
|
||||
#if (defined(TESTLEAKS) || defined(HEAPDBG)) && defined(COMPILER_GCC) && defined(UPP_HEAP)
|
||||
|
||||
//Place it to the begining of each file to be the first function called in whole executable...
|
||||
|
||||
//This is now backup to init_priority attribute in heapdbg.cpp
|
||||
//$-
|
||||
struct MemDiagCls {
|
||||
MemDiagCls() { if(!UPP::sMemDiagInitCount++) UPP::MemoryInitDiagnostics(); }
|
||||
~MemDiagCls() { if(!--UPP::sMemDiagInitCount) UPP::MemoryDumpLeaks(); }
|
||||
MemDiagCls();
|
||||
~MemDiagCls();
|
||||
};
|
||||
static const MemDiagCls sMemDiagHelper__upp__;
|
||||
//$+
|
||||
|
|
|
|||
|
|
@ -223,4 +223,25 @@ void MemoryInitDiagnostics()
|
|||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
||||
#if (defined(TESTLEAKS) || defined(HEAPDBG)) && defined(COMPILER_GCC) && defined(UPP_HEAP)
|
||||
|
||||
int sMemDiagInitCount;
|
||||
|
||||
MemDiagCls::MemDiagCls()
|
||||
{
|
||||
if(sMemDiagInitCount++ == 0)
|
||||
UPP::MemoryInitDiagnostics();
|
||||
}
|
||||
|
||||
MemDiagCls::~MemDiagCls()
|
||||
{
|
||||
if(--sMemDiagInitCount == 0)
|
||||
UPP::MemoryDumpLeaks();
|
||||
}
|
||||
|
||||
static const MemDiagCls sMemDiagHelper __attribute__ ((init_priority (101)));
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,14 +28,24 @@ void Ctrl::PanicMsgBox(const char *title, const char *text)
|
|||
LLOG("PanicMsgBox " << title << ": " << text);
|
||||
if(gdk_pointer_is_grabbed())
|
||||
gdk_pointer_ungrab(CurrentTime);
|
||||
char m[2000];
|
||||
*m = 0;
|
||||
if(system("which gxmessage") == 0)
|
||||
IGNORE_RESULT(system(String().Cat() << "gxmessage -center \"" << title << "\n" << text << "\""));
|
||||
strcpy(m, "gxmessage -center \"");
|
||||
else
|
||||
if(system("which kdialog") == 0)
|
||||
IGNORE_RESULT(system(String().Cat() << "kdialog --error \"" << title << "\n" << text << "\""));
|
||||
strcpy(m, "kdialog --error \"");
|
||||
else
|
||||
if(system("which xmessage") == 0)
|
||||
IGNORE_RESULT(system(String().Cat() << "xmessage -center \"" << title << "\n" << text << "\""));
|
||||
strcpy(m, "xmessage -center \"");
|
||||
|
||||
if(*m) {
|
||||
strcat(m, title);
|
||||
strcat(m, "\n");
|
||||
strcat(m, text);
|
||||
strcat(m, "\"");
|
||||
IGNORE_RESULT(system(m));
|
||||
}
|
||||
else {
|
||||
_DBG_Ungrab();
|
||||
GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue