Scheduler: Fixed access to uninitialized memory when creating a temporary object.

A temporary object needs to have the correct context.
However, this information was not provided correctly, so the context was set up from
an uninitialized memory qualifier, causing tests to fail on certain platforms.
This commit fixes this problem.