On Fri, Oct 22, 2010 at 4:15 PM, Rasmus Andersson <[email protected]> wrote:
> void *data = NULL; // points to something in reality > phandle.MakeWeak(data, &WeakCallback); > It would really surprise me if MakeWeak() does anything useful when passed a NULL pointer. If you just need a pointer to test with, the approach i like is: static int x = 42; void * data = &x; The "Handler" gets called as expected, but "WeakCallback" is never > called. > > Any ideas? > AFAIK, v8 never guarantees that the WeakCallback will _ever_ be called. Even when v8 shuts down, it might just quit without calling the destructors. It was explained once on this mailing list (a year or more ago) that that is for performance reasons in the Chrome browser, to avoid a long cleanup phase when the app is exiting and will be cleaned up by the OS. (i don't agree that the behaviour is correct, because it fails to recognize that destructors must be called for proper cleanup, but it's not my code.) -- ----- stephan beal http://wanderinghorse.net/home/stephan/ -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
