X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b90c32b486407a69ed81e8991c2ec8a6e0602431..8b3fddc49326c0b6019cd7082218726aa17a5727:/src/generic/accel.cpp?ds=sidebyside diff --git a/src/generic/accel.cpp b/src/generic/accel.cpp index d99b55cea6..21a745b598 100644 --- a/src/generic/accel.cpp +++ b/src/generic/accel.cpp @@ -53,7 +53,16 @@ WX_DEFINE_LIST(wxAccelList); class wxAccelRefData : public wxObjectRefData { public: - wxAccelRefData() { m_accels.DeleteContents(TRUE); } + wxAccelRefData() + { + m_accels.DeleteContents(TRUE); + } + + wxAccelRefData(const wxAccelRefData& data) + { + m_accels.DeleteContents(TRUE); + m_accels = data.m_accels; + } wxAccelList m_accels; }; @@ -61,6 +70,7 @@ public: // macro which can be used to access wxAccelRefData from wxAcceleratorTable #define M_ACCELDATA ((wxAccelRefData *)m_refData) + // ============================================================================ // implementation // ============================================================================ @@ -108,6 +118,8 @@ bool wxAcceleratorTable::Ok() const void wxAcceleratorTable::Add(const wxAcceleratorEntry& entry) { + AllocExclusive(); + if ( !m_refData ) { m_refData = new wxAccelRefData; @@ -118,6 +130,8 @@ void wxAcceleratorTable::Add(const wxAcceleratorEntry& entry) void wxAcceleratorTable::Remove(const wxAcceleratorEntry& entry) { + AllocExclusive(); + wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst(); while ( node ) { @@ -189,5 +203,15 @@ int wxAcceleratorTable::GetCommand(const wxKeyEvent& event) const return entry ? entry->GetCommand() : -1; } +wxObjectRefData *wxAcceleratorTable::CreateRefData() const +{ + return new wxAccelRefData; +} + +wxObjectRefData *wxAcceleratorTable::CloneRefData(const wxObjectRefData *data) const +{ + return new wxAccelRefData(*(wxAccelRefData *)data); +} + #endif // wxUSE_ACCEL