Bug 1274444 - Check for null console before attempting to flash it; r=glandium

GetConsoleWindow() can return NULL. Previously, we may have passed a NULL
console reference into FlashWindowEx(). On my machine (when running in a
console), passing NULL doesn't seem to cause an error. But since we have
a report of this function hanging, it is quite possible it can cause
hangs in other scenarios. Since a NULL console won't result in any
notification, let's not call FlashWindowEx() when no console is available.

MozReview-Commit-ID: LrKX8weUkzX

--HG--
extra : rebase_source : 6c3fc724dbc038f6b51bbdc14d985202c47074e8
This commit is contained in:
Gregory Szorc 2016-05-20 14:22:38 -07:00
Родитель 6a2720b1c2
Коммит fb053cc0d2
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -449,8 +449,15 @@ class MozbuildObject(ProcessExecutionMixin):
FLASHW_CAPTION = 0x01
FLASHW_TRAY = 0x02
FLASHW_TIMERNOFG = 0x0C
# GetConsoleWindows returns NULL if no console is attached. We
# can't flash nothing.
console = windll.kernel32.GetConsoleWindow()
if not console:
return
params = FLASHWINDOW(sizeof(FLASHWINDOW),
windll.kernel32.GetConsoleWindow(),
console,
FLASHW_CAPTION | FLASHW_TRAY | FLASHW_TIMERNOFG, 3, 0)
FlashWindowEx(params)
except Exception as e: