Refs #7582 supressed CppCheck warning

The cppcheck warning was a false positive as the varaible wasn't allocated before.

I think the reason cppcheck didn't like it is because i allocate it in a function.
Merge branch 'feature/7582_toolbar_menu' into develop