HaikuDepot: Make BitmapView use SharedBitmaps directly

Operating Systems / Haiku - Michael Lotz [mlotz.ch] - 8 April 2015 04:15 UTC

Instead of extracting a BBitmap out of the SharedBitmap and giving that to BitmapView, set SharedBitmaps directly. When using BBitmaps we circumvent the reference counting of the SharedBitmaps and it would be possible for the SharedBitmap and its BBitmaps to get deleted while one of them was still used in a BitmapView.

Fixes use-after-free when icons are updated that are already used in BitmapViews.

2a36368 HaikuDepot: Make BitmapView use SharedBitmaps directly.
src/apps/haikudepot/ui/FeaturedPackagesView.cpp | 15 ++++-----
src/apps/haikudepot/ui/PackageInfoView.cpp | 41 ++++++++++++-----------
src/apps/haikudepot/ui/ScreenshotWindow.cpp | 6 ++--
src/apps/haikudepot/ui/UserLoginWindow.cpp | 7 ++--
src/apps/haikudepot/ui_generic/BitmapView.cpp | 22 ++++++++++--
src/apps/haikudepot/ui_generic/BitmapView.h | 9 ++++-
6 files changed, 62 insertions(+), 38 deletions(-)

Upstream: cgit.haiku-os.org


  • Share