Fix AppMenuApplet Called C++ object pointer is null

Review Request #129994 - Created March 7, 2017 and submitted

Information
Leslie Zhai
plasma-workspace
master
Reviewers
plasma
broulik, davidedmundson

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


  

Issues

  • 0
  • 1
  • 0
  • 1
Description From Last Updated
Kai Uwe Broulik
Leslie Zhai
David Edmundson
Leslie Zhai
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 2b7ef97f8104db6212e2a75d2578c6edca96e05a by Leslie Zhai to branch master.
Loading...