Fix segmentation fault when calling window from certain panels.