Use wxInitializer in wxEntryReal() instead of directly calling wxEntryStart() without refcounting. This makes it possible to write hybrid CLI/GUI wx applications.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fb4b0165b2
commit
6ecb1fdd31
@ -113,14 +113,6 @@ private:
|
||||
wxAppConsole *m_app;
|
||||
};
|
||||
|
||||
// another tiny class which simply exists to ensure that wxEntryCleanup is
|
||||
// always called
|
||||
class wxCleanupOnExit
|
||||
{
|
||||
public:
|
||||
~wxCleanupOnExit() { wxEntryCleanup(); }
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private functions
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -422,7 +414,9 @@ void wxEntryCleanup()
|
||||
int wxEntryReal(int& argc, wxChar **argv)
|
||||
{
|
||||
// library initialization
|
||||
if ( !wxEntryStart(argc, argv) )
|
||||
wxInitializer initializer(argc, argv);
|
||||
|
||||
if ( !initializer.IsOk() )
|
||||
{
|
||||
#if wxUSE_LOG
|
||||
// flush any log messages explaining why we failed
|
||||
@ -431,12 +425,6 @@ int wxEntryReal(int& argc, wxChar **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// if wxEntryStart succeeded, we must call wxEntryCleanup even if the code
|
||||
// below returns or throws
|
||||
wxCleanupOnExit cleanupOnExit;
|
||||
|
||||
WX_SUPPRESS_UNUSED_WARN(cleanupOnExit);
|
||||
|
||||
wxTRY
|
||||
{
|
||||
// app initialization
|
||||
|
Loading…
Reference in New Issue
Block a user