From 4fd80960cae301271a19eb9bf52607fa7e011799 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 11 Sep 2018 01:38:39 +0200 Subject: [PATCH] Document wxGridTable::GetValueAsCustom() return value constraint The returned pointer must be allocated on the heap as wxGridCellDateTimeRenderer::GetString() currently deletes it. This seems like a rather poor idea, as any internally stored values must be cloned on each call, but it seems too dangerous to change this as it could result in massive memory leaks in the existing code. --- interface/wx/grid.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interface/wx/grid.h b/interface/wx/grid.h index 955f7aa5ac..5db6d6149c 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -1633,6 +1633,11 @@ public: This should only be called if CanGetValueAs() returns @true when called with @a typeName. Default implementation always return @NULL. + + Note that if the pointer is not null, it will be deleted by the caller, + so it must be allocated on the heap by any class overriding this + method. In practice, it means that the value stored internally must be + cloned on every call. */ virtual void *GetValueAsCustom(int row, int col, const wxString& typeName);