[vlmc-devel] [PATCH] Fix segmentation fault occured by deleting the same object twice

Hugo Beauzée-Luyssen hugo at beauzee.fr
Sat Mar 5 23:56:39 CET 2016


On 03/05/2016 05:16 PM, Yikai Lu wrote:
> There is
> 
> Core::~Core()
> {
> ...
>     delete m_workflowRenderer;
> ...
> }
> 
> So there is no need to delete the same object in the preview widget.
> ---
>  src/Gui/preview/PreviewWidget.cpp | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/Gui/preview/PreviewWidget.cpp b/src/Gui/preview/PreviewWidget.cpp
> index 1102c92..5547e53 100644
> --- a/src/Gui/preview/PreviewWidget.cpp
> +++ b/src/Gui/preview/PreviewWidget.cpp
> @@ -59,7 +59,6 @@ PreviewWidget::PreviewWidget( QWidget *parent )
>  
>  PreviewWidget::~PreviewWidget()
>  {
> -    delete m_renderer;
>      delete m_ui;
>  }
>  
> 
Applied, thanks!

Even better would be to start replacing raw pointers by shared_ptr or
unique_ptr depending on the cases.
I'm affraid there are a lot more of this kind of bugs, hidden everywhere
in the code.

Regards,

-- 
Hugo Beauzée-Luyssen
www.beauzee.fr


More information about the Vlmc-devel mailing list