[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Solid upower backend and kdeinit crash...
From:       Chani <chanika () gmail ! com>
Date:       2010-10-29 19:13:51
Message-ID: 201010292113.52193.chanika () gmail ! com
[Download RAW message or body]


On October 29, 2010 19:48:49 Dawit A wrote:
> Hi,
> 
> The upower backend, more specifically the XRandrBrightness class,
> causes kdeinit to crash on my system when you come back from screen
> lock mode. This happens because when the check for the backlight
> property fails in the constructor of XRandrBrightness, which happens
> on my system, it returns immediately. That leaves the m_resources
> variable set to NULL. Unfortunately both the brightness and
> setBrightness member functions use m_resources without even bothering
> to check whether it is null or not and hence the crash. Actually, the
> call to XRandrBrightness::brightness can be traced one step back to
> PowerDevilUPowerBackend::brightness which also does not bother to
> check whether the action it wants to obtain is supported or not before
> calling it, i.e. it does not do  XRandrBrightness::isSupported...
> 
> Anyhow, the issue can be fixed in a couple of ways, not returning when
> backlight check fails in ctor or checking validity of the m_resources
> pointer before using it. Not sure which would be the correct fix
> though. Any ideas ?

checking pointers (and supportedness) is generally a good idea. :)

but... it returns in the *constructor*? that sounds a little odd. I hope the 
contructor has at least initialized all its variables by then, so that you 
know m_resources will be null and not random garbage. I'd probably have to 
read the code to know whether it was sane (and I can't tell what constructor 
you're referring to)

-- 
Chani
http://chani.ca

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic