Mercurial > hg > orthanc-stone
diff Applications/Platforms/WebAssembly/WebAssemblyViewport.h @ 1623:74be0f498b08
Updated mechanism to avoid using deleted objects in RequestAnimationFrame callbacks.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 04 Nov 2020 11:39:15 +0100 |
parents | 575f512cdf48 |
children | 9ac2a65d4172 |
line wrap: on
line diff
--- a/Applications/Platforms/WebAssembly/WebAssemblyViewport.h Tue Nov 03 07:04:02 2020 +0100 +++ b/Applications/Platforms/WebAssembly/WebAssemblyViewport.h Wed Nov 04 11:39:15 2020 +0100 @@ -61,8 +61,6 @@ bool enableEmscriptenMouseEvents_; unsigned int canvasWidth_; unsigned int canvasHeight_; - std::vector<long> animationFrameCallbackIds_; - void* objectCookie_; static EM_BOOL OnRequestAnimationFrame(double time, void *userData); @@ -109,12 +107,12 @@ * This cookie is a resource and must be freed when it is guaranteed * not to be used anymore, with ReleaseObjectCookie */ - void* GetObjectCookie(); + void* CreateObjectCookie(); /** * This static method can be used to dereference a cookie (i.e. retrieve * a pointer to the underlying object) that has been created with - * WebAssemblyViewport::GetObjectCookie() + * WebAssemblyViewport::CreateObjectCookie() * * If this method returns NULL, it basically means that the * WebAssemblyViewport has already been deleted and that you should NOT @@ -128,7 +126,7 @@ * go wrong. * * NEVER call this method on a void* that has not been generated by the - * GetObjectCookie method of this class + * CreateObjectCookie method of this class */ static WebAssemblyViewport* DereferenceObjectCookie(void* cookie);