'tuple index out of range' on destroy of dialog when no button is pressed

Reported by Ronny Lorenz on 2012-02-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gDesklets
Undecided
Unassigned

Bug Description

I want to report a minor bug that annoys the logging message.
When gdeklets creates a dialog, i.e. a window with some text in it and several buttons to press for action and the user does not press any of those buttons but just closes the window a 'tuple index out of range' exception is raised:

 === Unhandled error! Something bad and unexpected happened. ===
tuple index out of range
in /usr/lib/gdesklets/utils/dialog.py: line 122 responder
/usr/lib/gdesklets/utils/dialog.py
  117
  118
  119 def _configurable(icon, primary, secondary, *buttons):
  120
  121 def responder(src, response):
> 122 callback = buttons[response][1]
  123 # Before calling back, check to see if it's callable
  124 if (callback and hasattr(callback, '__call__')): callback()
  125
  126 response = 0
  127 btns = []
  128 for label, callback in buttons:

This is due to the fact that the response value of just closing a window has value -4 (at least on my system) while it is assumed to return the index of the pressed button which should be >= 0

You can reproduce this behavior by starting gdesklets, right-click on the tray icon and select 'Check for updates'. A dialog appears that offers a 'Close' button. Close the window via the window-manager without pressing 'Close' and the exception will be raised. (Same effect with other dialog windows)

This bug is present in at least version 0.36.3 up to the latest bazar commit

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers