From 9af431e78e3fa4291ed2b876a5d9ca2669439310 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Wed, 21 Oct 2009 18:55:54 -0400 Subject: [PATCH] tentative fix for bug #61 --- Eigen/QtAlignedMalloc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Eigen/QtAlignedMalloc b/Eigen/QtAlignedMalloc index fde227328..dba7cb29e 100644 --- a/Eigen/QtAlignedMalloc +++ b/Eigen/QtAlignedMalloc @@ -3,6 +3,7 @@ #define EIGEN_QTMALLOC_MODULE_H #include "Core" +#include #if (!EIGEN_MALLOC_ALREADY_ALIGNED) @@ -24,6 +25,16 @@ inline void *qRealloc(void *ptr, size_t size) return newPtr; } +// needed to copy that too because it is implemented in the qt binary library, hence +// wouldn't otherwise honor our qMalloc. +QVectorData *QVectorData::malloc(int sizeofTypedData, int size, int sizeofT, QVectorData *init) +{ + QVectorData* p = (QVectorData *)qMalloc(sizeofTypedData + (size - 1) * sizeofT); + Q_CHECK_PTR(p); + ::memcpy(p, init, sizeofTypedData + (qMin(size, init->alloc) - 1) * sizeofT); + return p; +} + #endif #endif // EIGEN_QTMALLOC_MODULE_H