Suspicious code in kdegraphics-3.5.2
dang at kde.org
Fri May 19 13:53:43 BST 2006
I've applied all my fixes to these harmless warnings to trunk/KDE/kdegraphics.
Haven't touched branches/KDE/3.5/kdegraphics - that's supposed to be stable
code so if it ain't broke, won't fix it.
On Saturday 22 April 2006 22:19, Frans Englich wrote:
> On Saturday 22 April 2006 11:16, Clarence Dang wrote:
> > On Saturday 22 April 2006 09:36, Christoph Bartoschek wrote:
> > > - kolourpaint/tools/kptoolselection.cpp:1095
> > > - kolourpaint/tools/kptoolselection.cpp:1217
> > >
> > > && true ?
> > Left in for debugging - easy to change to "&& false".
> I think better debugging practices exists. That code ends up in production
> code and it is confusing.
Ok, convinced, fixed.
> > > If m_mainWindow is NULL as indicated by line 1637, then line 1646
> > > crashes.
> > "Will never happen". I am tempted simply to remove the "m_mainWindow"
> > checks entirely as "m_mainWindow" can never be NULL.
> If it's clear that it never can be null, such as that m_mainWindow is set
> in the constructor and that it's deleted in the destructor, I suggest:
> * Declare m_mainWindow to be a const pointer("QMainWindow *const
> m_mainWindow;") and initialize it with constructor initialization.
> * Add Q_ASSERTs do document and check that really is the case, in critical
> paths. This should hardly be necessary if you declare the pointer const.
Gone with the Q_ASSERT. Feel free to do the const pointer.
Both Coverity and Bartoschek should not find anything now.
Except I still have to check the Coverity
kpViewScrollableContainer::repaintWidgetAtResizeLineViewRect(QWidget *, const
QRect &) possible null ptr passed to dynamic_cast.
More information about the kde-core-devel