Closed GoogleCodeExporter closed 9 years ago
hello, is this the same as issue 88 or is there something differen't about this
one?
Original comment by CodyPrec...@gmail.com
on 3 Feb 2009 at 1:27
Hello. Different one. That one (88) happened on XP. This one (these two
actually)
happens on Vista and the crash here is a real crash (python.exe crash, editra
killed
by the OS) with no traceback.
Maybe the issues are correlated. I'll check at home on Vista with the update
you made
today.
Original comment by rudi.pet...@gmail.com
on 3 Feb 2009 at 2:35
No, the issue persists on Vista.
1. open an empty project
2. create "untitled folder"
3. create "untitled folder"\"untitled folder"
4. delete "untitled folder"\"untitled folder"
5. delete "untitled folder"
6. python.exe crash (status code: 0xC0000005, that is access violation)
The trace shows that tree.delete(node) in OnsyncNode is the offending
instruction
(100% reproducible on VISTA)
C:\Users\rd\src\editra>python launcher.py
BEGIN onPopupNewFolder
BEGIN OnSyncNode
END OnSyncNode
BEGIN onPopupNewFolder
BEGIN OnSyncNode
END OnSyncNode
BEGIN OnSyncNode
END OnSyncNode
BEGIN OnSyncNode
END OnSyncNode
delete(). selections = [(<wx._controls.TreeItemId; proxy of <Swig Object of type
'wxTreeItemId *' at 0x5081dc8> >
, u'C:\\Users\\rd\\Desktop\\vistaproj\\Untitled Folder\\Untitled Folder')],
thread
start with target delete...
BEGIN delete()
BEGIN OnSyncNode
END OnSyncNode
BEGIN OnSyncNode
OnSyncNode(): for item in deleted, deleted = [u'Untitled Folder'], item =
Untitled Folder
OnSyncNode(): self.tree.ItemHasChildren(node)
OnSyncNode() calling: "tree.delete(node)"
OnSyncNode() called: "tree.delete(node)"
END OnSyncNode
getMTime Error: [Error 3] The system cannot find the path specified:
u'C:\\Users\\rd\\Desktop\\vistaproj\\Untitle
d Folder\\Untitled Folder\\*.*'
BEGIN OnSyncNode
END OnSyncNode
BEGIN OnSyncNode
END OnSyncNode
delete(). selections = [(<wx._controls.TreeItemId; proxy of <Swig Object of type
'wxTreeItemId *' at 0x515be88> >
, u'C:\\Users\\rd\\Desktop\\vistaproj\\Untitled Folder')], thread start with
target
delete...
BEGIN delete()
BEGIN OnSyncNode
OnSyncNode(): for item in deleted, deleted = [u'Untitled Folder'], item =
Untitled Folder
OnSyncNode(): self.tree.ItemHasChildren(node)
OnSyncNode() calling: "tree.delete(node)"
getMTime Error: [Error 3] The system cannot find the path specified:
u'C:\\Users\\rd\\Desktop\\vistaproj\\Untitled Folder\\*.*'
getMTime Error: [Error 3] The system cannot find the path specified:
u'C:\\Users\\rd\\Desktop\\vistaproj\\Untitled Folder\\Untitled Folder\\*.*'
C:\Users\rd\src\editra>
Isnt't deleting the node from the wrong thread?
Original comment by rudi.pet...@gmail.com
on 3 Feb 2009 at 4:15
No, the deletion is happening in an event handler, events are only processed on
the
main thread ( you can verify this by putting a 'print wx.Thread_IsMain()' ).
An access violation error would suggest that the c++ code underneith is trying
to
access some memory that has already been deleted or is otherwise corrupt. Here
are a
couple of issues that I can think of that may be at fault here.
1) Each directory node has a watcher thread attached to it. These should
probably be
stopped before deleting the node to prevent them from sending further sync
events.
As I can see from your trace the getMTime calls from the watcher thread(s) are
are
still running after the node has been removed.
2) The nodes that show up in the 'deleted' list of OnSyncNodes should probably
be
ordered to find which ones are parent->children and make sure they are deleted
in
the proper order. i.e) parent.DeleteChildren() first, then make sure we dont'
try to
delete any nodes that may have been under there.
I would think that this would already be the case but will need checking.
Cody
Original comment by CodyPrec...@gmail.com
on 3 Feb 2009 at 4:31
Yes that thread seems to run forever. If you create a folder, delete it, and
then
watch the trace, you'll see that it "stat" that file forever.
Anyway notice that the crash happens on tree.delete()
...
OnSyncNode(): self.tree.ItemHasChildren(node)
OnSyncNode() calling: "tree.delete(node)"
>> crash here <<
>> kill app clicking on windows crash msgbox <<
getMTime for C:\Users\rd\Desktop\vistaproj\Untitled Folder
getMTime Error: [Error 3] The system cannot find the path specified:
u'C:\\Users\\rd\\Desktop\\vistaproj\\Untitled Folder\\*.*'
C:\Users\rd\src\editra>
Original comment by rudi.pet...@gmail.com
on 3 Feb 2009 at 5:39
Ok,
A simple test that you try then is to add a check for if the 'self.path' still
exists at the top of the loop in WatcherThread.run and return if it does not,
to
stop the thread.
OnSyncNodes should probably also check to see if the 'parent' node is in
the 'deleted' list. Then do something like the following if it is.
data = self.tree.GetPyData(parent)
if 'watcher' in data:
data['watcher'].flag = False
This should force the thread to exit within the next second.
Cody
Original comment by CodyPrec...@gmail.com
on 3 Feb 2009 at 6:09
Yes checking the path in WatcherThread.run stops it.
It seems I found a way to stop the crash happening. After reading this 9 months
old
thread about a subtle bug on Vista related to tree selection and deletion:
http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/98918
I decided - out of any logic - I could call tree.UnselectNode on the node being
deleted, and this way it stops crashing. Maybe it's just luck, but these
specific
use-case cannot be reproduced after applying the patch.
I attach a patch but maybe should need some testing and be applied only on
Vista (I
don't know if it can trigger some side-effects. I don't think so because you
are to
deleting it anyway)
Original comment by rudi.pet...@gmail.com
on 3 Feb 2009 at 8:54
forgot the patch
Original comment by rudi.pet...@gmail.com
on 3 Feb 2009 at 8:54
Attachments:
Thanks,
applied. Except for the check in the thread. Now that I think about it this may
need
to be handled in the OnSync or OnCollapse handler so that the thread is
properly
deleted from the watchers map in the project pane. Will try to check in those
changes tonight.
Cody
Original comment by CodyPrec...@gmail.com
on 3 Feb 2009 at 10:58
Original issue reported on code.google.com by
rudi.pet...@gmail.com
on 2 Feb 2009 at 10:23Attachments: