google-code-export / editra-plugins

Automatically exported from code.google.com/p/editra-plugins
2 stars 0 forks source link

[PyStudio] Crash in SetStepMarker #185

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Need to check that editor pointer is initialized / investigate why it was not.

Error report from automated error reporter:

#---- Traceback Info ----#
*** Thu Jun 9 16:55:31 2011 ***
Traceback (most recent call last):
File "/usr/lib64/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 
14656, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
File 
"/home/wbruhin/.config/Editra/plugins/PyStudio-0.2-py2.6.egg/PyStudio/Debugger/R
pdbStackFrameManager.py", line 60, in do_update_stack
self.do_update_frame(index)
File 
"/home/wbruhin/.config/Editra/plugins/PyStudio-0.2-py2.6.egg/PyStudio/Debugger/R
pdbStackFrameManager.py", line 43, in do_update_frame
self.do_set_position(index)
File 
"/home/wbruhin/.config/Editra/plugins/PyStudio-0.2-py2.6.egg/PyStudio/Debugger/R
pdbStackFrameManager.py", line 86, in do_set_position
self.rpdb2debugger.setstepmarker(filename, lineno)
File 
"/home/wbruhin/.config/Editra/plugins/PyStudio-0.2-py2.6.egg/PyStudio/Debugger/M
essageHandler.py", line 103, in SetStepMarker
self.editor.GotoLine(self.editorlineno)
AttributeError: 'NoneType' object has no attribute 'GotoLine'

Original issue reported on code.google.com by CodyPrec...@gmail.com on 9 Jun 2011 at 3:34

GoogleCodeExporter commented 9 years ago
A fix would be to add the check:
        self.editor = PyStudioUtils.GetEditorOrOpenFile(self.mainwindow, fileName)
        if not self.editor:
            return
        self.editorlineno = lineNo - 1
        self.editor.GotoLine(self.editorlineno)
        self.editor.ShowStepMarker(self.editorlineno, show=True)

However, I am wondering why self.editor would ever be None. 

As self.mainwindow is used in the call to PyStudioUtils.GetEditorOrOpenFile, if 
it was None, that would have caused a failure earlier, so it's not that. 

Is it that fileName is invalid? But then RpdbStackFrameManager passes the 
fileName from rpdb2 so don't see that it would pass an invalid path. Perhaps 
there is a problem opening the file? 

Need to find out from user wbruhin more about what he or she was doing when 
this happened.

Original comment by rans1...@gmail.com on 10 Jun 2011 at 5:07

GoogleCodeExporter commented 9 years ago
Are there still any remnant calls to normpath in the plugin?

That will fail on Linux since the file system is case sensitive and the name 
will no longer match.

Either need to use the real unaltered path name or need to do a case 
insensitive search when trying to locate a buffer.

Original comment by CodyPrec...@gmail.com on 10 Jun 2011 at 5:47

GoogleCodeExporter commented 9 years ago
There are no normpaths. There are normcases, but these should be fine as API 
says:
os.path.normcase(path)
    Normalize the case of a pathname. On Unix and Mac OS X, this returns the path unchanged; on case-insensitive filesystems, it converts the path to lowercase. On Windows, it also converts forward slashes to backward slashes.

Original comment by rans1...@gmail.com on 15 Jun 2011 at 3:01

GoogleCodeExporter commented 9 years ago
Yea that should be fine, also especially since the lookup for existing file 
uses the same call when doing the string matching.

The only thing I see is that the GetEditorForFile method is looping through the 
controls and then doing the following:

return nb.GetPage(page.GetTabIndex())

Its possible that the tab index could be out of sync and returning None. This 
call is unnecessary since the page instance is what you want to return.

Committed change to simplify this and remove the chance of the wrong object 
being returned.

return page

Also added 'if self.editor' check with log message for when get editor fails to 
help with debugging issue.

Closing as Fixed, please feel free to re-open if issue persists.

Original comment by CodyPrec...@gmail.com on 15 Jun 2011 at 3:25