GNOME Bugzilla – Bug 375558
Devices are not unregistering properly
Last modified: 2006-11-15 17:36:05 UTC
Please describe the problem: Devices are not unregistering properly thus persistence is lost from settings Steps to reproduce: 1. More than one input or output device must be registered. 2. Pull up settings dialog and change settings for a device. FestivalSpeech is first device so problem won't show up for it. 3. Quit LSR. 4. Start LSR and see if settings persisted. Actual results: The settings for the device will not persist Expected results: The settings should persist through multiple runs of LSR. Does this happen every time? Yes, this happens everytime. Other information: The problem is in DeviceManager.py. The close method iterates through both the input and output devices and calls unRegisterDevice for each. unRegisterDevice removes the device from the list which corrupts iterator in the close method. The solution is to make a copy of the list ie. for d in self.out_devs[:]: for both output and input loops. The unRegisterDevice may be best broken into two methods unRegisterOutputDevice and unRegisterInputDevice. Also, the unloadDevices method is not being called. It may be a candidate for removal.
Nice catch. Bug is now fixed in CVS. unloadDevices is being called from elsewhere in the system to support the runtime switching of preffered devices from the settings dialog. I've improved the comments so it's clearer why we have similar code in close() and in unloadDevices(). One day, they'll be merged.