Crash when closing tab where two controls are associated with the same drag and drop target

AK andrei.avk at gmail.com
Tue Mar 18 15:18:59 PDT 2008


Hello, I just had strange crashes when closing a tab and finally figured 
out what causes them. It turns out I can assign multiple fields to the 
same drag and drop target like this:

        dt = MyFileDropTarget(self, fileNameArea)
        self.text_area.SetDropTarget(dt)
        fileNameArea.SetDropTarget(dt)

And that works just fine. But when you close the tab where these 
controls are located, the app crashes without any errors. Solution is to 
do this:

        dt = MyFileDropTarget(self, fileNameArea)
        self.text_area.SetDropTarget(dt)
        dt = MyFileDropTarget(self, fileNameArea)
        fileNameArea.SetDropTarget(dt)


Hope this helps somebody who runs into this. By the way, if you're 
wondering why I do the same thing for dropping file into two separate 
fields, is that large text area is easier to drop files into and then 
put the location into attached file field, but it also makes sense and 
would be expected to have the same thing happen when file is dropped 
into attached file field itself. -andrei




More information about the wxpython-users mailing list