diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c index d26fbd3b8..264f6f8ed 100644 --- a/hw/xquartz/quartzKeyboard.c +++ b/hw/xquartz/quartzKeyboard.c @@ -1180,12 +1180,13 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { int is_uchr = 1, i, j; OSStatus err; KeySym *k; + CFDataRef currentKeyLayoutDataRef = NULL; TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource(); keyboard_type = LMGetKbdType(); if (currentKeyLayoutRef) { - CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData); + currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData); if (currentKeyLayoutDataRef) chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef); }