From 5adda5735a81d6e43804b0cbbeb5716679695040 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Mon, 28 Oct 2013 13:52:44 +0800 Subject: [PATCH] Fix memery leak of QXlsx::Cell --- src/xlsx/xlsxcell.cpp | 8 ++++++++ src/xlsx/xlsxcell.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/xlsx/xlsxcell.cpp b/src/xlsx/xlsxcell.cpp index 947a590..d27c066 100644 --- a/src/xlsx/xlsxcell.cpp +++ b/src/xlsx/xlsxcell.cpp @@ -58,6 +58,14 @@ Cell::Cell(const QVariant &data, DataType type, Format *format, Worksheet *paren d_ptr->parent = parent; } +/*! + * Destroys the Cell and cleans up. + */ +Cell::~Cell() +{ + delete d_ptr; +} + /*! * Return the dataType of this Cell */ diff --git a/src/xlsx/xlsxcell.h b/src/xlsx/xlsxcell.h index 33af031..2db413d 100644 --- a/src/xlsx/xlsxcell.h +++ b/src/xlsx/xlsxcell.h @@ -57,12 +57,12 @@ public: bool isDateTime() const; QDateTime dateTime() const; + ~Cell(); private: friend class Worksheet; friend class WorksheetPrivate; Cell(const QVariant &data=QVariant(), DataType type=Blank, Format *format=0, Worksheet *parent=0); - CellPrivate * const d_ptr; };