diff --git a/include/wx/event.h b/include/wx/event.h index ffe6121079..cf72a1d80d 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -2347,6 +2347,8 @@ public: // Clear all tables static void ClearAll(); + // Rebuild all tables + static void ReconstructAll(); protected: // Init the hash table with the entries of the static event table. diff --git a/src/common/event.cpp b/src/common/event.cpp index a3e0b004e1..22f3b07bc3 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -115,7 +115,11 @@ class wxEventTableEntryModule: public wxModule DECLARE_DYNAMIC_CLASS(wxEventTableEntryModule) public: wxEventTableEntryModule() {} - bool OnInit() { return true; } + bool OnInit() + { + wxEventHashTable::ReconstructAll(); + return true; + } void OnExit() { wxEventHashTable::ClearAll(); @@ -850,6 +854,23 @@ void wxEventHashTable::ClearAll() } } +// Rebuild all tables if they were cleared by ClearAll +void wxEventHashTable::ReconstructAll() +{ + wxEventHashTable* table = sm_first; + while (table) + { + // This will only be true if the event table was cleared. + // What we do here is basically what the constructor does. + if(table->m_eventTypeTable == NULL) + { + table->AllocEventTypeTable(EVENT_TYPE_TABLE_INIT_SIZE); + table->m_rebuildHash = true; + } + table = table->m_next; + } +} + bool wxEventHashTable::HandleEvent(wxEvent &event, wxEvtHandler *self) { if (m_rebuildHash) diff --git a/version-script.in b/version-script.in index e2063ed200..c7cdb4e3a6 100644 --- a/version-script.in +++ b/version-script.in @@ -53,6 +53,7 @@ *wxAuiNotebook*SetSelectedFont*; *wxAuiNotebook*ShowWindowMenu*; *wxDocument*GetUserReadableName*; + *wxEventHashTable*ReconstructAll*; *wxHtmlEasyPrinting*GetParentWindow*; *wxHtmlEasyPrinting*SetParentWindow*; *wxLog*DoCreateOnDemand*;