]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/common/appcmn.cpp
1. added range checks in wxGridStringTable
[wxWidgets.git] / src / common / appcmn.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: common/appcmn.cpp
3// Purpose: wxAppBase methods common to all platforms
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 18.10.99
7// RCS-ID: $Id$
8// Copyright: (c) Vadim Zeitlin
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ---------------------------------------------------------------------------
17// headers
18// ---------------------------------------------------------------------------
19
20#ifdef __GNUG__
21 #pragma implementation "appbase.h"
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#if defined(__BORLANDC__)
28 #pragma hdrstop
29#endif
30
31#ifndef WX_PRECOMP
32 #include "wx/app.h"
33 #include "wx/list.h"
34#endif
35
36#include "wx/thread.h"
37#include "wx/confbase.h"
38
39// ===========================================================================
40// implementation
41// ===========================================================================
42
43// ---------------------------------------------------------------------------
44// wxAppBase
45// ----------------------------------------------------------------------------
46
47void wxAppBase::ProcessPendingEvents()
48{
49 // ensure that we're the only thread to modify the pending events list
50 wxENTER_CRIT_SECT( *wxPendingEventsLocker );
51
52 if ( !wxPendingEvents )
53 {
54 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
55 return;
56 }
57
58 // iterate until the list becomes empty
59 wxNode *node = wxPendingEvents->First();
60 while (node)
61 {
62 wxEvtHandler *handler = (wxEvtHandler *)node->Data();
63 delete node;
64
65 // In ProcessPendingEvents(), new handlers might be add
66 // and we can safely leave the critical section here.
67 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
68 handler->ProcessPendingEvents();
69 wxENTER_CRIT_SECT( *wxPendingEventsLocker );
70
71 node = wxPendingEvents->First();
72 }
73
74 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
75}
76
77int wxAppBase::OnExit()
78{
79#if wxUSE_CONFIG
80 // delete the config object if any (don't use Get() here, but Set()
81 // because Get() could create a new config object)
82 delete wxConfigBase::Set((wxConfigBase *) NULL);
83#endif // wxUSE_CONFIG
84
85 return 0;
86}