Fix using pointer to temporary string.

The QString was destroyed with QFileInfo after the pointer was obtained.