GUI deveice detection: Handle case when user yanks connected device before device connection handler is called. Fixes #6864 (Unhandled exception, probably when trying to connect to iTunes/iPad)

This commit is contained in:
Kovid Goyal 2010-09-18 19:34:40 -06:00
parent 89c3e8ad87
commit 7d5da9f48d

View File

@ -707,6 +707,10 @@ class DeviceMixin(object): # {{{
'''
Called when a device is connected to the computer.
'''
# This can happen as this function is called in a queued connection and
# the user could have yanked the device in the meantime
if connected and not self.device_manager.is_device_connected:
connected = False
self.set_device_menu_items_state(connected)
if connected:
self.device_manager.get_device_information(\