[haiku-bugs] Re: [Haiku] #11563: HaikuDepot should have an advanced tab while opening package files directly

  • From: "stippi" <trac@xxxxxxxxxxxx>
  • Date: Sun, 22 Feb 2015 19:50:35 -0000

#11563: HaikuDepot should have an advanced tab while opening package files 
directly
---------------------------------------+----------------------------
   Reporter:  kallisti5                |      Owner:  stippi
       Type:  enhancement              |     Status:  new
   Priority:  normal                   |  Milestone:  R1
  Component:  Applications/HaikuDepot  |    Version:  R1/Development
 Resolution:                           |   Keywords:
 Blocked By:                           |   Blocking:
Has a Patch:  0                        |   Platform:  All
---------------------------------------+----------------------------

Comment (by stippi):

 Sorry for the late reply... I realize that patch is not the current one.
 It would be good to always leave the latest patch attached to the ticket.
 That way, if I suddenly find myself with some free time, I am looking at
 the current state of the work.

 Anyway, if `fPackageIcon` is a reference to a `SharedBitmap`, then you
 assign it like this:
 {{{
 fPackageIcon.SetTo(new(std::nothrow) SharedBitmap(source), true);
 }}}

 1) You have to create the `SharedBitmap` on the heap, since it is supposed
 to stay allocated when the function returns or the variable goes out of
 scope for other reasons.

 2) You pass `true` to `SetTo()`, since creating the `SharedBitmap` with
 new creates an initial reference. You don't want to add another reference,
 so you pass `true` for the `alreadyHasReference` parameter.

--
Ticket URL: <https://dev.haiku-os.org/ticket/11563#comment:30>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: