Yes, looks ok.
You have verified that the "ui" pointer has been initialized properly?

Cheers,
_