Fix for a crash occurring when the window is resized.
Temporary Platform objects were registering themselves. The move ctor would then initialize the final object in the circular buffer (see PlatformSystem), but it would leave the address of the temporary object registered in the ObserversManager.
This commit is contained in:
parent
0c8e9b2d7c
commit
b4ddfa8f4f
5 changed files with 27 additions and 5 deletions
|
@ -96,6 +96,7 @@ namespace cloonel {
|
|||
|
||||
TicketType Add ( T parObserver );
|
||||
void Remove ( TicketType parTicket ) noexcept;
|
||||
void Update ( TicketType parTicket, T parObserver );
|
||||
std::size_t size ( void ) const { return m_usedCount; }
|
||||
iterator begin ( void ) { return iterator(m_occupied, m_list, false); }
|
||||
iterator end ( void ) { return iterator(m_occupied, m_list, true); }
|
||||
|
@ -148,6 +149,18 @@ namespace cloonel {
|
|||
m_list.resize(newSize);
|
||||
}
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void ObserversManager<T>::Update (TicketType parTicket, T parObserver) {
|
||||
assert(static_cast<std::size_t>(parTicket) <= m_list.size());
|
||||
assert(m_occupied[parTicket - 1]);
|
||||
assert(m_usedCount > 0);
|
||||
assert(m_list.size() == m_occupied.size());
|
||||
|
||||
std::swap(m_list[parTicket - 1], parObserver);
|
||||
}
|
||||
} //namespace cloonel
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue