Fix possible crash in TabWidget