Review Request 111040: Fix possibly memory leak by not called destructor on incomplete type in kis_mask.cc
Boudewijn Rempt
boud at valdyas.org
Tue Jun 18 13:24:16 BST 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111040/#review34560
-----------------------------------------------------------
Ship it!
Ship It!
- Boudewijn Rempt
On June 15, 2013, 1:19 p.m., Friedrich W. H. Kossebau wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/111040/
> -----------------------------------------------------------
>
> (Updated June 15, 2013, 1:19 p.m.)
>
>
> Review request for Calligra, Dmitry Kazakov and Boudewijn Rempt.
>
>
> Description
> -------
>
> Noone noticed this warning by the compiler?
>
> [ 37%] Building CXX object krita/image/CMakeFiles/kritaimage.dir/kis_mask.cc.o
> /home/koder/Kode/kdegit/Calligra/calligra/krita/image/kis_mask.cc: In member function ‘void KisMask::Private::initSelectionImpl(KisSelectionSP, KisLayerSP, KisPaintDeviceSP)’:
> /home/koder/Kode/kdegit/Calligra/calligra/krita/image/kis_mask.cc:149:39: warning: possible problem detected in invocation of delete operator: [enabled by default]
> /home/koder/Kode/kdegit/Calligra/calligra/krita/image/kis_mask.cc:149:39: warning: invalid use of incomplete type ‘class KUndo2Command’ [enabled by default]
> In file included from /home/koder/Kode/kdegit/Calligra/calligra/krita/image/kis_mask.h:25:0,
> from /home/koder/Kode/kdegit/Calligra/calligra/krita/image/kis_mask.cc:20:
> /home/koder/Kode/kdegit/Calligra/calligra/krita/image/kis_types.h:229:7: warning: forward declaration of ‘class KUndo2Command’ [enabled by default]
> /home/koder/Kode/kdegit/Calligra/calligra/krita/image/kis_mask.cc:149:39: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
>
> See e.g. http://en.wikibooks.org/wiki/More_C++_Idioms/Checked_delete for the background. Short, delete on objects of incomplete type is just undefined, so not an error usually, thus the compiler will not stop on it.
>
> Attached patch fixes it by including kundo2command.h as needed to complete the type. Don't have sufficient understanding of the surrounding code, so please check if this does result in what is wanted here.
>
> In general:
> Please watch the compiler warnings. Ideally there are NullNada????? warnings :)
>
>
> Diffs
> -----
>
> krita/image/kis_mask.cc b6388a7
>
> Diff: http://git.reviewboard.kde.org/r/111040/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Friedrich W. H. Kossebau
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20130618/20e54b9e/attachment.htm>
More information about the calligra-devel
mailing list