Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/24ec30359be98b64f7668df6172047b740d9d9f2
...commit
http://git.netsurf-browser.org/netsurf.git/commit/24ec30359be98b64f7668df6172047b740d9d9f2
...tree
http://git.netsurf-browser.org/netsurf.git/tree/24ec30359be98b64f7668df6172047b740d9d9f2
The branch, master has been updated
via 24ec30359be98b64f7668df6172047b740d9d9f2 (commit)
from bf4cbc95b0a4d57dd90908dca5524801af4ca91e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=24ec30359be98b64f7668df6172047b740d9d9f2
commit 24ec30359be98b64f7668df6172047b740d9d9f2
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
Window: Do not get stuck if callbacks are in-train during compartment close
When we close the JS compartment we try and cancel all callbacks so that
they do not fire after the compartment is closed. However if we have
in-train callbacks, they can gum up the closedown and so we need to check
and if we've done all we can, we break out of the callback removal loop.
Signed-off-by: Daniel Silverstone <[email protected]>
diff --git a/content/handlers/javascript/duktape/Window.bnd
b/content/handlers/javascript/duktape/Window.bnd
index d87c94f..175f4ac 100644
--- a/content/handlers/javascript/duktape/Window.bnd
+++ b/content/handlers/javascript/duktape/Window.bnd
@@ -235,9 +235,38 @@ static duk_ret_t dukky_window_closedown_thread(duk_context
*ctx)
NSLOG(dukky, DEEPDEBUG, "Closing down thread");
while (priv->schedule_ring != NULL) {
+ window_schedule_t *to_remove = NULL;
+ // Find a schedule item to remove
+ RING_ITERATE_START(window_schedule_t, priv->schedule_ring,
sched) {
+ if (sched->running == false) {
+ // This one is not running, we can remove it
+ to_remove = sched;
+ RING_ITERATE_STOP(window->schedule_ring, sched);
+ } else if (sched->repeat_timeout != 0) {
+ // This one is running and has yet to be
+ // cancelled, so prevent it rescheduling itself
+ NSLOG(dukky, DEEPDEBUG,
+ "Cancelling in-train callback %"PRIsizet,
+ sched->handle);
+ sched->repeat_timeout = 0;
+ }
+ } RING_ITERATE_END(priv->schedule_ring, sched);
+
+ if (to_remove == NULL) {
+ // We didn't find any non-running callbacks
+ // so let's log that and break out of the closedown
+ // loop so we can continue and hopefully close down
+ NSLOG(dukky, DEEPDEBUG,
+ "Leaving in-train callbacks to unwind");
+ break;
+ }
+
+ // Remove the handle we found, this will reduce the callback
+ // scheduler ring by one and perhaps leave it empty so we can
+ // finish the closedown.
window_remove_callback_by_handle(ctx,
priv,
- priv->schedule_ring->handle);
+ to_remove->handle);
}
return 0;
-----------------------------------------------------------------------
Summary of changes:
content/handlers/javascript/duktape/Window.bnd | 31 +++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/content/handlers/javascript/duktape/Window.bnd
b/content/handlers/javascript/duktape/Window.bnd
index d87c94f..175f4ac 100644
--- a/content/handlers/javascript/duktape/Window.bnd
+++ b/content/handlers/javascript/duktape/Window.bnd
@@ -235,9 +235,38 @@ static duk_ret_t dukky_window_closedown_thread(duk_context
*ctx)
NSLOG(dukky, DEEPDEBUG, "Closing down thread");
while (priv->schedule_ring != NULL) {
+ window_schedule_t *to_remove = NULL;
+ // Find a schedule item to remove
+ RING_ITERATE_START(window_schedule_t, priv->schedule_ring,
sched) {
+ if (sched->running == false) {
+ // This one is not running, we can remove it
+ to_remove = sched;
+ RING_ITERATE_STOP(window->schedule_ring, sched);
+ } else if (sched->repeat_timeout != 0) {
+ // This one is running and has yet to be
+ // cancelled, so prevent it rescheduling itself
+ NSLOG(dukky, DEEPDEBUG,
+ "Cancelling in-train callback %"PRIsizet,
+ sched->handle);
+ sched->repeat_timeout = 0;
+ }
+ } RING_ITERATE_END(priv->schedule_ring, sched);
+
+ if (to_remove == NULL) {
+ // We didn't find any non-running callbacks
+ // so let's log that and break out of the closedown
+ // loop so we can continue and hopefully close down
+ NSLOG(dukky, DEEPDEBUG,
+ "Leaving in-train callbacks to unwind");
+ break;
+ }
+
+ // Remove the handle we found, this will reduce the callback
+ // scheduler ring by one and perhaps leave it empty so we can
+ // finish the closedown.
window_remove_callback_by_handle(ctx,
priv,
- priv->schedule_ring->handle);
+ to_remove->handle);
}
return 0;
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]