Commit d9ca22a3 authored by Ian Hickson's avatar Ian Hickson

have invokeFrameCallback print the right stack (#3351)

Exception stack variable was shadowing the function argument stack.
parent e41c1c0b
...@@ -296,20 +296,20 @@ abstract class Scheduler extends BindingBase { ...@@ -296,20 +296,20 @@ abstract class Scheduler extends BindingBase {
/// the error. /// the error.
/// ///
/// Must not be called reentrantly from within a frame callback. /// Must not be called reentrantly from within a frame callback.
void invokeFrameCallback(FrameCallback callback, Duration timeStamp, [ StackTrace stack ]) { void invokeFrameCallback(FrameCallback callback, Duration timeStamp, [ StackTrace callbackStack ]) {
assert(callback != null); assert(callback != null);
assert(_FrameCallbackEntry.currentCallbackStack == null); assert(_FrameCallbackEntry.currentCallbackStack == null);
assert(() { _FrameCallbackEntry.currentCallbackStack = stack; return true; }); assert(() { _FrameCallbackEntry.currentCallbackStack = callbackStack; return true; });
try { try {
callback(timeStamp); callback(timeStamp);
} catch (exception, stack) { } catch (exception, exceptionStack) {
FlutterError.reportError(new FlutterErrorDetails( FlutterError.reportError(new FlutterErrorDetails(
exception: exception, exception: exception,
stack: stack, stack: exceptionStack,
library: 'scheduler library', library: 'scheduler library',
context: 'during a scheduler callback', context: 'during a scheduler callback',
informationCollector: (stack == null) ? null : (StringBuffer information) { informationCollector: (callbackStack == null) ? null : (StringBuffer information) {
information.writeln('When this callback was registered, this was the stack:\n$stack'); information.writeln('When this callback was registered, this was the stack:\n$callbackStack');
} }
)); ));
} }
......
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