Use the deferred virtual call mechanism to avoid the virtual
call bug in the constructor. See docs/wrong_virtual_call.md for a description.
This commit is contained in:
parent
0b6cdeb5f5
commit
5e76b49cae
6 changed files with 64 additions and 11 deletions
|
@ -1,8 +1,8 @@
|
|||
#include "sizenotifiable.hpp"
|
||||
#include "sizeratio.hpp"
|
||||
#include "sdlmain.hpp"
|
||||
#include <cassert>
|
||||
#include <ciso646>
|
||||
#include <exception>
|
||||
|
||||
namespace cloonel {
|
||||
namespace implem {
|
||||
|
@ -62,4 +62,12 @@ namespace cloonel {
|
|||
///--------------------------------------------------------------------------
|
||||
void SizeNotifiableBase::OnResChanged (const SizeRatio&) {
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
DeferredRegister::~DeferredRegister() {
|
||||
assert(m_call);
|
||||
if (not std::uncaught_exception())
|
||||
m_call();
|
||||
}
|
||||
} //namespace cloonel
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue