fix scope leak in tooltip

Fixes #2709