GoogleCodeArchives / editra

Automatically exported from code.google.com/p/editra
Other
0 stars 0 forks source link

[codebrowser] Errors in new sync code #360

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open file using open dialog 

What is the expected output? What do you see instead?
CodeBrowser tree does not refresh.

Please use labels and text to provide additional information.
Refresh is disabled if the main window is not active and on the top.
See: _ShouldUpdate in cbrowser

Original issue reported on code.google.com by igor.dejanovic@gmail.com on 22 May 2009 at 11:24

GoogleCodeExporter commented 9 years ago
This references unapplied patch.
Cody, please close this as invalid.
Sorry for cluttering up issue browser.

Igor

Original comment by igor.dejanovic@gmail.com on 22 May 2009 at 12:10

GoogleCodeExporter commented 9 years ago
So this is fine?

There was an issue on Linux because of this in the past. Because the dialog is
returned in GetTopWindow (where on all other platforms dialogs are not top
windows...) So I thought this may be a regression.

Original comment by CodyPrec...@gmail.com on 22 May 2009 at 12:25

GoogleCodeExporter commented 9 years ago
Also on a similar note:

Issue: 282

http://code.google.com/p/editra/issues/detail?id=282

Can your reproduce the problem in that one. I have not been able to on any of my
machines.

Thanks,

Cody

Original comment by CodyPrec...@gmail.com on 22 May 2009 at 12:40

GoogleCodeExporter commented 9 years ago
Got this error today while using the new code:

*** Fri May 22 18:55:03 2009 ***
Traceback (most recent call last):
  File
"/Users/codyprecord/Desktop/devel/Editra/plugins/codebrowser/codebrowser/cbrowse
r.py",
line 104, in <lambda>
    self.Bind(wx.EVT_TIMER, lambda evt: self._SyncTree(), self._sync_timer)
  File
"/Users/codyprecord/Desktop/devel/Editra/plugins/codebrowser/codebrowser/cbrowse
r.py",
line 224, in _SyncTree
    scope_item = self._FindNodeForLine(line)
  File
"/Users/codyprecord/Desktop/devel/Editra/plugins/codebrowser/codebrowser/cbrowse
r.py",
line 166, in _FindNodeForLine
    self._log("[codebrowser][info] For line %d found item %s" % (line,
self._GetFQN(rval)))
  File
"/Users/codyprecord/Desktop/devel/Editra/plugins/codebrowser/codebrowser/cbrowse
r.py",
line 142, in _GetFQN
    rval = self.GetItemText(node)
  File
"//usr/local/lib/wxPython-unicode-2.8.9.2/lib/python2.5/site-packages/wx-2.8-mac
-unicode/wx/_controls.py",
line 5288, in GetItemText
    return _controls_.TreeCtrl_GetItemText(*args, **kwargs)
PyAssertionError: C++ assertion "stringSrc.GetStringData()->IsValid()" failed at
/BUILD/wxPython-src-2.8.9.2/include/wx/string.h(352) in wxStringBase(): did you
forget to call UngetWriteBuf()?

Original comment by CodyPrec...@gmail.com on 22 May 2009 at 11:57

GoogleCodeExporter commented 9 years ago
More trouble, the following sequence will cause the program to lockup and crash:

1) Start Editra

2) Open a Python (or any codebrowser supported file)

3) Open a plain text file (code tree becomes empty)

4) Close the Plain text file

As the page switches back to the opened python file the program appears to go 
into an
infinite loop and eventually has to be force quit.

Original comment by CodyPrec...@gmail.com on 23 May 2009 at 1:13

GoogleCodeExporter commented 9 years ago
Hi Cody,
I am a bit out of the time at the moment but I will investigate this issue later
today. I tried to reproduce it on multiple copies of Editra with different
configurations but I could not do it reliably so I guess it could be some kind 
of
race condition. I am new to wx so not quite sure how timers are implemented. Are
their handlers executed on the GUI thread or different thread is involved?
I will also look at the issue 282.

Igor

Original comment by igor.dejanovic@gmail.com on 23 May 2009 at 11:19

GoogleCodeExporter commented 9 years ago
I think I have traced down the problem with lockups and _GetFQN. It was not 
related
to timer event handling.
I forgot to do _ds_flat cache cleanup in some circumstances. So, here is a 
patch that
seems to solve the issue.
I still don't feel confident about timer handlers, though.

Igor

Original comment by igor.dejanovic@gmail.com on 23 May 2009 at 1:27

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, thats seems to fix it.

The timers are all handled on the main thread through the event queue so I don't
think there should be any race conditions as the event handlers are handled in a
serialized way.

Potentially the timer event would be fired after the buffer it was for was 
destroyed.

I can't reproduce either of these crashes anymore but will keep this open for a 
while
to test a little more.

Original comment by CodyPrec...@gmail.com on 24 May 2009 at 3:43

GoogleCodeExporter commented 9 years ago
Issue 367 has been merged into this issue.

Original comment by CodyPrec...@gmail.com on 30 May 2009 at 2:05

GoogleCodeExporter commented 9 years ago
Got another crash while working with this on Windows today.

*** Fri May 29 14:38:09 2009 ***
Traceback (most recent call last):
  File "build\bdist.win32\egg\codebrowser\cbrowser.py", line 104, in <lambda>
    self.Bind(wx.EVT_TIMER, lambda evt: self._SyncTree(), self._sync_timer)
  File "build\bdist.win32\egg\codebrowser\cbrowser.py", line 231, in _SyncTree
    scope_item = self._FindNodeForLine(line)
  File "build\bdist.win32\egg\codebrowser\cbrowser.py", line 173, in
_FindNodeForLine
    self._log("[codebrowser][info] For line %d found item %s" % (line,
self._GetFQN(rval)))
  File "build\bdist.win32\egg\codebrowser\cbrowser.py", line 142, in _GetFQN
    rval = u'%s.%s' % (self._GetFQN(parent), self.GetItemText(node))
  File "build\bdist.win32\egg\codebrowser\cbrowser.py", line 142, in _GetFQN
    rval = u'%s.%s' % (self._GetFQN(parent), self.GetItemText(node))
  File "build\bdist.win32\egg\codebrowser\cbrowser.py", line 142, in _GetFQN
    rval = u'%s.%s' % (self._GetFQN(parent), self.GetItemText(node))
  File "build\bdist.win32\egg\codebrowser\cbrowser.py", line 144, in _GetFQN
    rval = self.GetItemText(node)
  File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_controls.py",
line 5303, in GetItemText
    return _controls_.TreeCtrl_GetItemText(*args, **kwargs)
PyAssertionError: C++ assertion "tvItem->hItem !=
((HTREEITEM)(ULONG_PTR)-0x10000)" failed at ..\..\src\msw\treectrl.cpp(854)
in wxTreeCtrl::DoGetItem(): can't retrieve virtual root item

This feature is really nice, hopefully we can get the rest of these kinks 
worked out
soon.

cody

Original comment by CodyPrec...@gmail.com on 30 May 2009 at 2:07

GoogleCodeExporter commented 9 years ago
Here is a patch for _GetFQN that will hopefully solve windows issue. I don't 
have win
installation at hand to check this.
I see that in the last change you have commented out call to _GetFQN for 
logging, so
this is not an issue anymore, but I am posting this nevertheless just in case 
we need
this func in the future.

Igor

Original comment by igor.dejanovic@gmail.com on 30 May 2009 at 10:18

Attachments:

GoogleCodeExporter commented 9 years ago
Applied thanks,

Will test on Monday when I can get to my Windows machine

Cody

Original comment by CodyPrec...@gmail.com on 30 May 2009 at 11:00

GoogleCodeExporter commented 9 years ago
Good old windows treectrl is always causing trouble. There is a more serious 
error
now after this patch as it happens everytime I click somewhere in the edit area.

*** Mon Jun 01 08:20:50 2009 ***
Traceback (most recent call last):
  File "build\bdist.win32\egg\codebrowser\cbrowser.py", line 104, in <lambda>
    self.Bind(wx.EVT_TIMER, lambda evt: self._SyncTree(), self._sync_timer)
  File "build\bdist.win32\egg\codebrowser\cbrowser.py", line 241, in _SyncTree
    self.ToggleItemSelection(selected)
  File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_controls.py", line 5541,
in ToggleItemSelection
    return _controls_.TreeCtrl_ToggleItemSelection(*args, **kwargs)
PyAssertionError: C++ assertion "select" failed at 
..\..\src\msw\treectrl.cpp(1823)
in wxTreeCtrl::SelectItem(): SelectItem(false) works only for multiselect

This error seems a little bogus to me as I don't see why you would have to have 
a
multi select tree in order to toggle the items selection, but in my experience 
the
Windows version of the TreeCtrl has allot of these type of restrictions on it.

cody

Original comment by CodyPrec...@gmail.com on 1 Jun 2009 at 1:24

GoogleCodeExporter commented 9 years ago
Docs clearly states that ToggleItemSelection is for multiselect trees only. I
overlooked this. The strange thing is that it works on linux but not on windows.
Probably the default settings for trees differs between platforms.
Anyway, here is a patch that removes ToggleItemSelection.
Cody, could you test this on windows?

Igor

Original comment by igor.dejanovic@gmail.com on 1 Jun 2009 at 2:48

Attachments:

GoogleCodeExporter commented 9 years ago
Applied,

And it seems that all issues are resolved now as I cannot get any more crashes.

I see that ToggleItemSelection is documented like that, though I don't really 
see the
rational for it. It would be easier to implement in a single select control 
than a
multiselect, and it also works fine on OSX and Linux (as you mentioned).

Anyway, thanks for the fix.

Closing this as resolved.

Cody

Original comment by CodyPrec...@gmail.com on 1 Jun 2009 at 3:00