[haiku-commits] Re: haiku: hrev45034 - in src/apps/debugger/user_interface: cli util

  • From: Clemens <clemens.zeidler@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 21 Dec 2012 09:31:18 +1300

On Fri, 21 Dec 2012 09:08:21 +1300, Rene Gollent <anevilyak@xxxxxxxxx> wrote:


On Dec 20, 2012 2:58 PM, "Clemens" <clemens.zeidler@xxxxxxxxx> wrote:

no, there is only one reference in the calling code and _RegisterCommand
creates a CommandEntry holding a ref.

deleting all CommandEntry s would delete the object

Again, no. Each entry does get one, yes, but _RegisterCommand takes over
the initial one passed in (see its first lines) to ensure the command gets
cleaned up in case creating the entry fails.

Rene

ok I see why it was done in the first place:

if (_RegisterCommand("bt", stackTraceCommandReference.Detach())
                && _RegisterCommand("continue", new(std::nothrow) 
CliContinueCommand)
                && _RegisterCommand("frame", new(std::nothrow) 
CliStackFrameCommand)

matter of taste, I would say, would pass a reference here as well, just a more consistent use of refs...

cheers,
        Clemens

Other related posts: