Bug in DirectGUI OkDialog?

i got a strange behaviour when working with the directGUI OkDialog.
i have 2 pieces of code… one which generates a ok-dialog and one which removes it again:

self.regError = OkDialog( dialogName="Sorry", text ="Registering the account failed", command = self.removeRegError)


def removeRegError(self,attribute):

when i open the OkDialog everything is fine… and i can close it just like it should. but if i try to open it again it crashes panda . that’s what i get as debug output:

Traceback (most recent call last):
  File "ff8online.py", line 842, in ?
  File "/usr/share/panda3d/direct/src/showbase/ShowBase.py", line 2028, in run
  File "/usr/share/panda3d/direct/src/task/Task.py", line 839, in run
  File "/usr/share/panda3d/direct/src/task/Task.py", line 787, in step
  File "/usr/share/panda3d/direct/src/task/Task.py", line 721, in __stepThroughList
    ret = self.__executeTask(task)
  File "/usr/share/panda3d/direct/src/task/Task.py", line 644, in __executeTask
    ret = task(task)
  File "ff8online.py", line 370, in readTask
    command = self.removeRegError)
  File "/usr/share/panda3d/direct/src/gui/DirectDialog.py", line 349, in __init__
    DirectDialog.__init__(self, parent)
  File "/usr/share/panda3d/direct/src/gui/DirectDialog.py", line 131, in __init__
  File "/usr/share/panda3d/direct/src/gui/DirectDialog.py", line 35, in cleanupDialog
  File "/usr/share/panda3d/direct/src/gui/DirectDialog.py", line 329, in cleanup
    uniqueName = self['dialogName']
  File "/usr/share/panda3d/direct/src/gui/DirectGuiBase.py", line 437, in cget
    if self._optionInfo.has_key(option):
AttributeError: 'OkDialog' object has no attribute '_optionInfo'

maybe i should mention that i run the create thing inside a task…
is this a bug or some other strange behaviour or something or did i make a huge mistake somewhere?

thx in advance

You’re right. Creating it inside a task is not the problem. I created it using keybinding, and it throwed the same error.
Using cleanup() rather than destroy() solves this.

thx a lot =) this did the trick.
*note added to the wiki