MacOS: get instruction stream after closing buffer.
authorErik Verbruggen <erik.verbruggen@me.com>
Sat, 27 Jul 2013 13:11:27 +0000 (15:11 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 31 Jul 2013 10:34:45 +0000 (12:34 +0200)
Otherwise the QByteArray's constData might have been relocated, and the
output might be anything but correct (e.g. empty).

Change-Id: I2eb1223d2e0577f41c8f9e6ce81cb65af05166da
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/v4/qv4isel_masm.cpp

index d4c8499..af77a7c 100644 (file)
@@ -608,10 +608,10 @@ void Assembler::link(QV4::Function *vmFunc)
 
         WTF::setDataFile(stderr);
 #if (OS(LINUX) && !defined(Q_OS_ANDROID)) || OS(MAC_OS_X)
+        fclose(disasmStream);
 #  if OS(MAC_OS_X)
         char *disasmOutput = memStream.buf.data();
 #  endif
-        fclose(disasmStream);
 #  if CPU(X86) || CPU(X86_64)
         QHash<void*, String*> idents;
         printDisassembledOutputWithCalls(disasmOutput, functions, _vmFunction->identifiers);