# SwEng
png.h, wxwidgets.h: automatically link against lib files main: document and avoid potential memory leak with args AtlasUI/ErrorReporter: move crashlog_sender.cpp here as per Philip's suggestion. currently disabled via #if 0 stdafx: add missing header apparently required by trigger.h This was SVN commit r5034.
This commit is contained in:
parent
b918fec071
commit
44f5288a1d
@ -2,3 +2,12 @@
|
||||
#include "lib/external_libraries/zlib.h"
|
||||
|
||||
#include <png.h>
|
||||
|
||||
// automatically link against the required library
|
||||
#if MSC_VERSION
|
||||
# ifdef NDEBUG
|
||||
# pragma comment(lib, "libpng13.lib")
|
||||
# else
|
||||
# pragma comment(lib, "libpng13d.lib")
|
||||
# endif // NDEBUG
|
||||
#endif // MSC_VERSION
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* =========================================================================
|
||||
* File : wxw.h
|
||||
* File : wxwidgets.h
|
||||
* Project : 0 A.D.
|
||||
* Description : pulls in wxWidgets headers, with compatibility fixes
|
||||
*
|
||||
@ -20,8 +20,8 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WXW
|
||||
#define INCLUDED_WXW
|
||||
#ifndef INCLUDED_WXWIDGETS
|
||||
#define INCLUDED_WXWIDGETS
|
||||
|
||||
// prevent wxWidgets from pulling in windows.h - it's mostly unnecessary
|
||||
// and interferes with posix_sock's declarations.
|
||||
@ -51,4 +51,39 @@ typedef struct HINSTANCE__* HINSTANCE; // definition as if STRICT were #defined
|
||||
#endif // __WXMSW__
|
||||
|
||||
|
||||
#endif // #ifndef INCLUDED_WXW
|
||||
// automatically link against the required library
|
||||
#if MSC_VERSION
|
||||
# ifdef NDEBUG
|
||||
# else
|
||||
# pragma comment(lib, "wxmsw28ud_core.lib")
|
||||
# pragma comment(lib, "wxmsw28ud_qa.lib")
|
||||
# pragma comment(lib, "wxbase28ud.lib")
|
||||
# pragma comment(lib, "wxbase28ud_xml.lib")
|
||||
|
||||
|
||||
//# pragma comment(lib, "wxbase28ud_net.lib")
|
||||
//# pragma comment(lib, "wxbase28ud_odbc.lib")
|
||||
//# pragma comment(lib, "wxmsw28ud_adv.lib")
|
||||
//# pragma comment(lib, "wxmsw28ud_aui.lib")
|
||||
//# pragma comment(lib, "wxmsw28ud_dbgrid.lib")
|
||||
//# pragma comment(lib, "wxmsw28ud_gl.lib")
|
||||
//# pragma comment(lib, "wxmsw28ud_html.lib")
|
||||
//# pragma comment(lib, "wxmsw28ud_media.lib")
|
||||
//# pragma comment(lib, "wxmsw28ud_richtext.lib")
|
||||
//# pragma comment(lib, "wxmsw28ud_xrc.lib")
|
||||
//# pragma comment(lib, "wxexpatd.lib")
|
||||
//# pragma comment(lib, "wxpngd.lib")
|
||||
//# pragma comment(lib, "wxjpegd.lib")
|
||||
//# pragma comment(lib, "wxtiffd.lib")
|
||||
//# pragma comment(lib, "wxzlibd.lib")
|
||||
//# pragma comment(lib, "wxregexd.lib")
|
||||
|
||||
# pragma comment(lib, "Rpcrt4.lib") // Uuid
|
||||
# pragma comment(lib, "comctl32.lib") // ImageList_*
|
||||
|
||||
|
||||
# endif // NDEBUG
|
||||
#endif // MSC_VERSION
|
||||
|
||||
|
||||
#endif // #ifndef INCLUDED_WXWIDGETS
|
||||
|
@ -38,13 +38,6 @@
|
||||
// called in their prolog/epilog code).
|
||||
# pragma warning(disable: 4611)
|
||||
|
||||
// pull in the appropriate debug/release library
|
||||
# ifdef NDEBUG
|
||||
# pragma comment(lib, "libpng13.lib")
|
||||
# else
|
||||
# pragma comment(lib, "libpng13d.lib")
|
||||
# endif // NDEBUG
|
||||
|
||||
#endif // MSC_VERSION
|
||||
|
||||
|
||||
|
@ -357,6 +357,28 @@ void kill_mainloop()
|
||||
}
|
||||
|
||||
|
||||
// moved into a helper function to ensure args is destroyed before
|
||||
// exit(), which may result in a memory leak.
|
||||
static void RunGameOrAtlas(int argc, char* argv[])
|
||||
{
|
||||
CmdLineArgs args(argc, argv);
|
||||
|
||||
// run Atlas (if requested via args)
|
||||
bool ran_atlas = ATLAS_RunIfOnCmdLine(args);
|
||||
// Atlas handles the whole init/shutdown/etc sequence by itself;
|
||||
// when we get here, it has exited and we're done.
|
||||
if(ran_atlas)
|
||||
return;
|
||||
|
||||
// run the game
|
||||
Init(args, 0);
|
||||
MainControllerInit();
|
||||
while(!quit)
|
||||
Frame();
|
||||
Shutdown(0);
|
||||
MainControllerShutdown();
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// If you ever want to catch a particular allocation:
|
||||
@ -367,22 +389,7 @@ int main(int argc, char* argv[])
|
||||
wstartup_PreMainInit();
|
||||
#endif
|
||||
|
||||
CmdLineArgs args(argc, argv);
|
||||
|
||||
// run Atlas (if requested via args)
|
||||
bool ran_atlas = ATLAS_RunIfOnCmdLine(args);
|
||||
// Atlas handles the whole init/shutdown/etc sequence by itself,
|
||||
// so just exit after it has run.
|
||||
if(ran_atlas)
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
// run the game
|
||||
Init(args, 0);
|
||||
MainControllerInit();
|
||||
while(!quit)
|
||||
Frame();
|
||||
Shutdown(0);
|
||||
MainControllerShutdown();
|
||||
RunGameOrAtlas(argc, argv);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* =========================================================================
|
||||
* File : debug_report.cpp
|
||||
* File : ErrorReporter.cpp
|
||||
* Project : 0 A.D.
|
||||
* Description : preview and send crashlogs to server.
|
||||
*
|
||||
@ -14,9 +14,12 @@
|
||||
* License: wxWindows license
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "lib/external_libraries/wxwidgets.h"
|
||||
#if 0
|
||||
|
||||
#include "wx/statline.h"
|
||||
#include "wx/mimetype.h"
|
||||
|
||||
static const wxChar* DIALOG_TITLE = _T("WildfireGames Reporting Utility");
|
||||
static const wxChar* PROBLEM_TITLE = _T("Problem Report for 0AD");
|
||||
@ -357,8 +360,7 @@ bool wxDebugReportDialog::TransferDataToWindow()
|
||||
const size_t count = m_dbgrpt.GetFilesCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
wxString name,
|
||||
desc;
|
||||
wxString name, desc;
|
||||
if ( m_dbgrpt.GetFile(n, &name, &desc) )
|
||||
{
|
||||
m_checklst->Append(name + _T(" (") + desc + _T(')'));
|
||||
@ -640,71 +642,22 @@ public:
|
||||
// application class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// this is a usual application class modified to work with debug reporter
|
||||
//
|
||||
// basically just 2 things are necessary: call wxHandleFatalExceptions() as
|
||||
// early as possible and override OnFatalException() to create the report there
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
public:
|
||||
// call wxHandleFatalExceptions here
|
||||
MyApp();
|
||||
bool m_uploadReport = true;
|
||||
|
||||
// create our main window here
|
||||
virtual bool OnInit();
|
||||
//m_generateReport = false; //Flag to report back to wxWidgets that indicates
|
||||
//whether the DoProcess() method should be called.
|
||||
//GenerateReport(false); //Create the compressed report file.
|
||||
//The argument is not used in this version but
|
||||
//is meant to indicate whether crash files already
|
||||
//existed and the calling method did not create new ones.
|
||||
//false means the crash files were recently generated...
|
||||
//true means they already existed.
|
||||
|
||||
// called when a crash occurs in this application
|
||||
//virtual void OnFatalException();
|
||||
|
||||
// this is where we really generate the debug report
|
||||
void GenerateReport(bool CrashFilesExist);
|
||||
|
||||
// if this function is called, we'll use MyDebugReport which would try to
|
||||
// upload the (next) generated debug report to its URL, otherwise we just
|
||||
// generate the debug report and leave it in a local file
|
||||
void UploadReport(bool doIt) { m_uploadReport = doIt; }
|
||||
|
||||
private:
|
||||
bool m_uploadReport;
|
||||
bool m_generateReport;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(MyApp)
|
||||
};
|
||||
// this is where we really generate the debug report
|
||||
//void GenerateReport(bool CrashFilesExist);
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// MyApp
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
MyApp::MyApp()
|
||||
{
|
||||
// user needs to explicitely enable this
|
||||
m_uploadReport = false;
|
||||
|
||||
// call this to tell the library to call our OnFatalException()
|
||||
//wxHandleFatalExceptions();
|
||||
}
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
if ( !wxApp::OnInit() )
|
||||
return false;
|
||||
|
||||
m_uploadReport = true; //Upload the compressed report.
|
||||
m_generateReport = false; //Flag to report back to wxWidgets that indicates
|
||||
//whether the DoProcess() method should be called.
|
||||
GenerateReport(false); //Create the compressed report file.
|
||||
//The argument is not used in this version but
|
||||
//is meant to indicate whether crash files already
|
||||
//existed and the calling method did not create new ones.
|
||||
//false means the crash files were recently generated...
|
||||
//true means they already existed.
|
||||
//new MyFrame;
|
||||
|
||||
return m_generateReport;
|
||||
}
|
||||
|
||||
void MyApp::GenerateReport(bool CrashFilesExist)
|
||||
void GenerateReport()
|
||||
{
|
||||
wxDebugReportCompress *report = m_uploadReport ? new MyDebugReport
|
||||
: new wxDebugReportCompress;
|
||||
@ -714,22 +667,19 @@ void MyApp::GenerateReport(bool CrashFilesExist)
|
||||
fn2 = _T(LOGS_LOCATION);
|
||||
fn2 += _T("crashlog.txt");
|
||||
|
||||
if(!CrashFilesExist) //This flag better be false or nothing will get added.
|
||||
{
|
||||
if(wxFileExists(fn1))
|
||||
report->AddFile(fn1, _T("memory dump"));
|
||||
else
|
||||
wxLogError(_T("crashlog.dmp not found!"));
|
||||
if(wxFileExists(fn2))
|
||||
report->AddFile(fn2, _T("debug information"));
|
||||
else
|
||||
wxLogError(_T("crashlog.txt not found!"));
|
||||
}
|
||||
if(wxFileExists(fn1))
|
||||
report->AddFile(fn1, _T("memory dump"));
|
||||
else
|
||||
wxLogError(_T("crashlog.dmp not found!"));
|
||||
if(wxFileExists(fn2))
|
||||
report->AddFile(fn2, _T("debug information"));
|
||||
else
|
||||
wxLogError(_T("crashlog.txt not found!"));
|
||||
|
||||
//Then call the built in wxWidgets dialog which is modified to be
|
||||
//customizable for each individual project and can be found in
|
||||
// *****dbgrptg.cpp*****
|
||||
m_generateReport = wxDebugReportPreviewStd().Show(*report);
|
||||
bool m_generateReport = wxDebugReportPreviewStd().Show(*report);
|
||||
if ( m_generateReport )
|
||||
{ //User clicked OK
|
||||
if ( report->Process() )
|
||||
@ -753,3 +703,4 @@ void MyApp::GenerateReport(bool CrashFilesExist)
|
||||
delete report;
|
||||
}
|
||||
|
||||
#endif
|
1
source/tools/atlas/AtlasUI/ErrorReporter/ErrorReporter.h
Normal file
1
source/tools/atlas/AtlasUI/ErrorReporter/ErrorReporter.h
Normal file
@ -0,0 +1 @@
|
||||
void ReportError();
|
@ -12,6 +12,7 @@
|
||||
#include "ColourTester/ColourTester.h"
|
||||
#include "FileConverter/FileConverter.h"
|
||||
#include "ScenarioEditor/ScenarioEditor.h"
|
||||
#include "ErrorReporter/ErrorReporter.h"
|
||||
|
||||
#include "GameInterface/MessagePasser.h"
|
||||
|
||||
@ -119,6 +120,13 @@ ATLASDLLIMPEXP void Atlas_DisplayError(const wchar_t* text, unsigned int WXUNUSE
|
||||
// this function is called
|
||||
}
|
||||
|
||||
|
||||
ATLASDLLIMPEXP void Atlas_ReportError()
|
||||
{
|
||||
///ReportError(); // janwas: disabled until ErrorReporter.cpp compiles
|
||||
}
|
||||
|
||||
|
||||
class AtlasDLLApp : public wxApp
|
||||
{
|
||||
public:
|
||||
|
@ -11,3 +11,5 @@ ATLASDLLIMPEXP void Atlas_GLSwapBuffers(void* context);
|
||||
ATLASDLLIMPEXP void Atlas_NotifyEndOfFrame();
|
||||
|
||||
ATLASDLLIMPEXP void Atlas_DisplayError(const wchar_t* text, unsigned int flags);
|
||||
|
||||
ATLASDLLIMPEXP void Atlas_ReportError();
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "wx/sound.h"
|
||||
#include "wx/spinctrl.h"
|
||||
#include "wx/splitter.h"
|
||||
#include "wx/notebook.h" // required by SectionLayout.cpp -> Trigger.h
|
||||
#include "wx/tooltip.h"
|
||||
#include "wx/treectrl.h"
|
||||
#include "wx/wfstream.h"
|
||||
|
Loading…
Reference in New Issue
Block a user