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

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 23 Jan 2015 15:24:23 +0100

Hi,

Am 23.01.2015 um 13:46 schrieb pulkomandy@xxxxxxxxxxxxx:
hrev48711 adds 1 changeset to branch 'master'
old head: 84ed7b4bb4ad1c0f002ecc475e6f048904ffea58
new head: 6f3acb91631d60911121f71ebd92b15d5f08b63b
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=6f3acb91631d+%5E84ed7b4bb4ad

----------------------------------------------------------------------------

6f3acb91631d: app_server: fix misuse of BReferenceable.

Can you please 1) use an appropriate description and 2) make sure your commits are actually correct? You are degrading the code quality with such hasty "fixes". 1) There was no "misuse" of BReferenceable. Just because the debug code of BReferenceable does not handle some perfectly valid use cases does not mean these perfectly valid use-cases are "misuse". 2) You've introduced a memory leak, since you have not adjusted the fBitmap initialization. You need to tell the reference that you already have a reference (the initial reference count of newly created references is 1). If you don't do that, the BReference acquires an *additional* reference and the bitmap is now leaked.

So instead of fixing anything, you actually broke it. Just saying. :-(

Note that this regression is elliminated by your later commit which skips using the reference.

Best regards,
-Stephan



   Fixes #9989.

                                  [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev48711
Commit:      6f3acb91631d60911121f71ebd92b15d5f08b63b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6f3acb91631d
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Fri Jan 23 12:46:04 2015 UTC

Ticket:      https://dev.haiku-os.org/ticket/9989

----------------------------------------------------------------------------

2 files changed, 2 insertions(+), 3 deletions(-)
src/servers/app/drawing/BitmapDrawingEngine.cpp | 3 +--
src/servers/app/drawing/BitmapDrawingEngine.h   | 2 +-

----------------------------------------------------------------------------

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();

        if (newWidth <= 0 || newHeight <= 0)
                return B_OK;
diff --git a/src/servers/app/drawing/BitmapDrawingEngine.h 
b/src/servers/app/drawing/BitmapDrawingEngine.h
index 11e5b81..ae054cb 100644
--- a/src/servers/app/drawing/BitmapDrawingEngine.h
+++ b/src/servers/app/drawing/BitmapDrawingEngine.h
@@ -25,7 +25,7 @@ virtual                                                       
~BitmapDrawingEngine();
  private:
                        color_space                     fColorSpace;
                        BitmapHWInterface*      fHWInterface;
-                       UtilityBitmap*          fBitmap;
+                       BReference<UtilityBitmap> fBitmap;
                        BRegion                         fClipping;
  };





Other related posts: