[haiku-commits] Re: haiku: hrev48711 - src/servers/app/drawing

  • From: Rene Gollent <anevilyak@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 23 Jan 2015 07:53:59 -0500

On Fri, Jan 23, 2015 at 7:46 AM,  <pulkomandy@xxxxxxxxxxxxx> wrote:
> diff --git a/src/servers/app/drawing/BitmapDrawingEngine.cpp 
> b/src/servers/app/drawing/BitmapDrawingEngine.cpp
> index 3c360b1..eee10c8 100644
> --- a/src/servers/app/drawing/BitmapDrawingEngine.cpp
> +++ b/src/servers/app/drawing/BitmapDrawingEngine.cpp
> @@ -56,8 +56,7 @@ BitmapDrawingEngine::SetSize(int32 newWidth, int32 
> newHeight)
>                 fHWInterface = NULL;
>         }
>
> -       delete fBitmap;
> -       fBitmap = NULL;
> +       fBitmap.Unset();

There's really no need/benefit to wrapping it in a BReference here,
you could simply have called ReleaseReference() instead of delete. The
same goes for the previous change, it could simply have been allocated
on the heap and had ReleaseReference() called on it in the destructor.
BReference is mainly intended for stack-based usage to ensure the
reference is always released properly when one is acquired for the
duration of a particular scope such as a function where there might be
multiple exit points.

Regards,

Rene

Other related posts: