Regression in running tests with log output redirected to file
To reproduce:
GJS_DEBUG_OUTPUT=log.txt _build/installed-tests/js/minijasmine installed-tests/js/testself.js
Backtrace:
#0 0x00007ffff790b787 in __GI_fseek (fp=0x0, offset=0, whence=2) at fseek.c:35
#1 0x00007ffff7eed26c in write_to_stream(FILE*, char const*, char const*)
(logfp=0x0, prefix=0x7ffff7f309c2 "JS MEMORY", s=0x57d3d0 "Memory report: after destroying context") at ../util/log.cpp:180
#2 0x00007ffff7eed58a in gjs_debug(GjsDebugTopic, char const*, ...)
(topic=GJS_DEBUG_MEMORY, format=0x7ffff7f1a421 "Memory report: %s")
at ../util/log.cpp:234
#3 0x00007ffff7eac557 in gjs_memory_report(char const*, bool)
(where=0x40232d "after destroying context", die_if_leaks=true)
at ../gjs/mem.cpp:32
#4 0x0000000000401637 in main(int, char**) (argc=2, argv=0x7fffffffe008)
at ../installed-tests/minijasmine.cpp:117
The cause is that when the log is not going to stderr, you cannot log the memory report after the context is destroyed, because the FP is closed and nulled.