Commit 88b2abde authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Concurrent.Promise: Improved behavior for CONCURRENT_DEBUG.

Don't store raw backtraces, they may contain references to stuff
that the user doesn't expect to get extra references.
parent eab2ec6a
......@@ -884,9 +884,6 @@ class Promise
final int _materialised;
final AggregateState _astate;
array(Pike.BacktraceFrame) createdat;
//! Creates a new promise, optionally initialised from a traditional callback
//! driven method via @expr{executor(success, failure, @@extra)@}.
......@@ -897,9 +894,6 @@ class Promise
function(mixed:void), mixed ...:void) executor, mixed ... extra)
createdat = backtrace()[..<1];
if (executor)
executor(success, failure, @extra);
......@@ -1201,15 +1195,21 @@ class Promise
return max_failures(-1);
private string orig_backtrace =
sprintf("%s\n------\n", describe_backtrace(backtrace()))
protected void _destruct()
// NB: Don't complain about dropping STATE_NO_FUTURE on the floor.
if (state == STATE_PENDING)
try_failure(({ sprintf("%O: Promise broken.\n", this),
this->createdat ||
backtrace() }));
try_failure(({ sprintf("%O: Promise broken.\n%s",
this, orig_backtrace),
backtrace() }));
if ((state == STATE_REJECTED) && global_on_failure)
call_callback(global_on_failure, result);
result = UNDEFINED;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment