Solid upower backend and kdeinit crash...
Alexander Neundorf
neundorf at kde.org
Sat Oct 30 18:07:12 BST 2010
On Saturday 30 October 2010, Matthias Fuchs wrote:
> Am Freitag 29 Oktober 2010, 22:28:01 schrieb Dawit A:
> > On Fri, Oct 29, 2010 at 3:48 PM, Chani <chanika at gmail.com> wrote:
> > >> > 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)
> > >>
> > >> kdebase/workspace/powerdevil/daemon/backends/upower/xrandrbrightness.c
> > >>pp
> > >
> > > oh jeez, it doesn't init m_backlight if it doesn't get far enough... it
> > > should init that to *something*. especially since other functions are
> > > using it. meep.
> >
> > yep...
> >
> > > hmm, and m_isSuppported is logically equivalent to (m_resources !=
> > > null) so it's redundant - but harmless.
> >
> > yep... there is no need for that flag at all. It is redundant.
> >
> > > I say, make sure m_backlight has a default value up there where
> > > m_resources is set null, and then add an isSupported check at the top
> > > of *every* function in there (well, besides itself of course ;)
> >
> > Or set the m_backlight as you stated, get rid of the unnecessary
> > m_isSupported flag altogether
> > and simply check m_resources before using it, as in the attached patch...
> >
> > :)
>
> Wouldn't it be better to have
> if (cur != -1.0)
> ?
Comparing floats for equality is dangerous.
Alex
More information about the kde-core-devel
mailing list