linuxmint/Cinnamon — pull request #3182 by mtwebster (2014-05-23 04:44:48+00:00)
Title: global: Add a js context GC active state, to prevent multiple gjs_context_gc calls.

I had a freeze, attached gdb, and discovered two calls to that function
called from run_leisure_functions (which is only queued up at the end of
a tweening operation), and they were both in the gjs_context_gc (which
simply calls spidermonkey's JS_GC() function.

This patch will set a global flag as gjs_context_gc is called, which
is then removed when we receive a callback that garbage collection is
complete.

Any call during that active timeframe will check the active state,
and retry once after waiting 100ms. Only once because this will all
sort itself out on the next tween if we miss our initial tries. Also
I thought it should be self-limiting to prevent any sort of runaway
reaction of backlogged GC calls.

In practice, this patch really does nothing. I am unable to trigger
this condition intentionally, it seems like a perfect storm sort of
situation, but maybe this will prevent a few unexplained freezes.