From 7d5da9f48d59254db290c6bf87a4111a0d633fbc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 18 Sep 2010 19:34:40 -0600 Subject: [PATCH] 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) --- src/calibre/gui2/device.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index b20cd7594f..ae3141db56 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -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(\