[haiku-bugs] Re: [Haiku] #7810: Deskbar crashs when Battery::GetBatteryInfoCached

  • From: "modeenf" <trac@xxxxxxxxxxxx>
  • Date: Thu, 28 Nov 2013 09:59:50 -0000

#7810: Deskbar crashs when Battery::GetBatteryInfoCached
----------------------------------------+----------------------------
   Reporter:  Arnaud M.                 |      Owner:  axeld
       Type:  bug                       |     Status:  new
   Priority:  normal                    |  Milestone:  R1
  Component:  Applications/PowerStatus  |    Version:  R1/Development
 Resolution:                            |   Keywords:
 Blocked By:                            |   Blocking:
Has a Patch:  0                         |   Platform:  x86
----------------------------------------+----------------------------

Comment (by modeenf):

 Would changing line 101

 {{{if (fCachedAcpiInfo.current_rate > 0)}}}

 to

 {{{if (fCachedAcpiInfo.current_rate > 0 || fRateBuffer.GetMeanRate() >
 0)}}}

 fix that?

 or chould one add

 {{{
 int meanRate = fRateBuffer.GetMeanRate();
 if (fCachedAcpiInfo.current_rate > 0 ||  meanRate > 0)
                 info->time_left = 3600 * fCachedAcpiInfo.capacity
                         / meanRate;
 }}}

--
Ticket URL: <http://dev.haiku-os.org/ticket/7810#comment:11>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: