Update description for the bug fixed in the previous commit.

This commit is contained in:
King_DuckZ 2016-11-10 23:26:41 +01:00
parent 5e76b49cae
commit b5f7e30471

View file

@ -1,3 +1,4 @@
## Bug description ##
1) SizeNotifiable, defined as the following:
class SizeNotifiable<RegisterBehaviour, true> : private RegisterBehaviour, public SizeNotifiableBase { ... };
@ -23,3 +24,7 @@ note that parNotifiable is received from SizeNotifiable's constructor, so it's a
parNotif is, again, the partly constructed object pointed by this in SizeNotifiable's constructor. NotifyResChanged() is a virtual method, thus the bug.
Objects being registered need to be notified straight away since they have no clue about the current size held by SDLMain.
## Solution ##
Fixed at commit 5e76b49cae954accd1533d6b6431af7cb5f770ef doing something that I call *deferred virtual call*. A temporary object is passed down in the SizeNotifiable's hierarchy. This object's destructor calls the Register() method *if the stack is not being unwinded due to an exception*. Since the object is passed from the top (from outside the topmost constructor), its destructor gets called after the end of the scope of the topmost constructor in the SizeNotifiable's hierarchy. By that point all virtual tables should be set to their final state.