[vlc-devel] [PATCH] gui/qt: menus: do not use VLC_OBJECT on NULL

Filip Roséen filip at atch.se
Thu Feb 23 14:54:24 CET 2017


VLC_OBJECT reaches inside the data-members of the passed pointer to
reach the intrinsic object, so that a pointer to the internal
vlc_object_t can be created.

This, per definition, is a dereference of the pointer passed to the
macro, and we should of course not dereference NULL pointers.
---
 modules/gui/qt/menus.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index cd3ac0898b..953dfc5f05 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -214,7 +214,7 @@ static QAction * FindActionWithVar( QMenu *menu, const char *psz_var )
 #define PUSH_OBJVAR(object,var) \
     do { \
         varnames.append(var); \
-        objects.append(VLC_OBJECT(object)); \
+        objects.append(object ? VLC_OBJECT(object) : NULL); \
     } while (0)
 
 #define PUSH_VAR(var) PUSH_OBJVAR(p_object, var)
-- 
2.11.1



More information about the vlc-devel mailing list