> On 三月 7, 2017, 7:45 p.m., Kai Uwe Broulik wrote: > > applets/appmenu/lib/appmenuapplet.cpp, line 167 > > <https://git.reviewboard.kde.org/r/129994/diff/1/?file=492314#file492314line167> > > > > Prefer !ctx instead of comparing with nullptr > > > > Also, could you move the check up a bit so we don't do unneccessary > > work, ie. > > > > if (m_currentIndex == idx) { > > return; > > } > > > > if (!ctx || !ctx->window() ....) { > > return; > > } > > > > QMenu *actionMenu = createMenu(idx);
Hi Kai, Why use nullptr everywhere? it is my understanding http://www.leetcode.cn/2017/02/use-nullptr-everywhere.html please point out my fault, thanks! Regards, Leslie Zhai - Leslie ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/129994/#review102749 ----------------------------------------------------------- On 三月 8, 2017, 10:17 a.m., Leslie Zhai wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://git.reviewboard.kde.org/r/129994/ > ----------------------------------------------------------- > > (Updated 三月 8, 2017, 10:17 a.m.) > > > Review request for Plasma, Kai Uwe Broulik and David Edmundson. > > > Repository: plasma-workspace > > > Description > ------- > > Hi KDE developer, > > Bug reported by the clang static analyzer. > > Description: Called C++ object pointer is null > File: plasma-workspace/applets/appmenu/lib/appmenuapplet.cpp > Line: 167 > > ``` > 153 void AppMenuApplet::trigger(QQuickItem *ctx, int idx) > 154 { > 155 if (m_currentIndex == idx) { > > Taking false branch > ? > 156 return; > 157 } > 158 > 159 QMenu *actionMenu = createMenu(idx); > 160 if (actionMenu) { > > ? > Assuming 'actionMenu' is non-null > ? > > ? > Taking true branch > ? > 161 > 162 if (ctx && ctx->window() && ctx->window()->mouseGrabberItem()) { > 4 > ? > Assuming 'ctx' is null > ? > 163 // FIXME event forge thing enters press and hold move mode > :/ > 164 ctx->window()->mouseGrabberItem()->ungrabMouse(); > 165 } > 166 > 167 const auto &geo = > ctx->window()->screen()->availableVirtualGeometry(); > 5 > ? > Called C++ object pointer is null > ``` > > So I simply add some checker for ctx, ctx->window() and > ctx->window()->screen() pointers. > > Regards, > Leslie Zhai > > > Diffs > ----- > > applets/appmenu/lib/appmenuapplet.cpp 9aaf5cc6 > > Diff: https://git.reviewboard.kde.org/r/129994/diff/ > > > Testing > ------- > > > Thanks, > > Leslie Zhai > >