Commit c12cefbb authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner.NodeInstance: Add environment variable to disable shared memory



Change-Id: I4146186d57322e8dd06b5c3baf538c98119ff201
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@nokia.com>
parent e767fb28
......@@ -90,7 +90,9 @@ static QSharedMemory *createSharedMemory(qint32 key, int byteCount)
QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command)
{
if (command.valueChanges().count() > 5) {
static const bool dontUseSharedMemory = !qgetenv("DESIGNER_DONT_USE_SHARED_MEMORY").isEmpty();
if (!dontUseSharedMemory && command.valueChanges().count() > 5) {
static quint32 keyCounter = 0;
++keyCounter;
command.m_keyNumber = keyCounter;
......
......@@ -143,19 +143,26 @@ static void writeStream(QDataStream &out, const QImage &image)
QDataStream &operator<<(QDataStream &out, const ImageContainer &container)
{
const int extraDataSize = 20;
static const bool dontUseSharedMemory = !qgetenv("DESIGNER_DONT_USE_SHARED_MEMORY").isEmpty();
out << container.instanceId();
out << container.keyNumber();
const QImage image = container.image();
QSharedMemory *sharedMemory = createSharedMemory(container.keyNumber(), image.byteCount() + extraDataSize);
out << qint32(sharedMemory != 0); // send if shared memory is used
if (sharedMemory)
writeSharedMemory(sharedMemory, image);
else
if (dontUseSharedMemory) {
out << qint32(0);
writeStream(out, image);
} else {
QSharedMemory *sharedMemory = createSharedMemory(container.keyNumber(), image.byteCount() + extraDataSize);
out << qint32(sharedMemory != 0); // send if shared memory is used
if (sharedMemory)
writeSharedMemory(sharedMemory, image);
else
writeStream(out, image);
}
return out;
}
......
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