On Sun, Jan 25, 2009 at 10:00 AM, Edward K. Ream <[email protected]>wrote:

>
>> there are still problems with changes to headlines going away after
>> operations that change the current position.
>
>
Here is yet another way to create a hard crash.

- Insert a new headline.
- (probably optional) Type 'a' to change the headline.
- Type F3 to start find-next.
- Type a value that will only match a following headline.
- Hit return

A little single-stepping shows that the crash happens when trying to set the
focus to self.w in
Code-->Core classes-->@thin leoEditCommands.py--><< define class
baseEditCommandsClass >>-->editWidget (baseEditCommandsClass)

I think what happens is this:  The F3 event sets the edit commands .w ivar
to the headline. Alas, Qt apparently destroys the headline widget when the
tree loses focus to the minibuffer, so when (later) the edit code tries to
reset the focus back to the headline there is no edit widget left. A hard
crash is the lamentable and inevitable result.

This kind of error never happens with the tk code, because edit widgets only
get deallocated on redraws.

What to do...The crash happens "early" in the find logic, before any of the
methods in leoFind.py get called.  So no modifications there can possibly be
effective.

Here is the point at which I knew that a hard crash was going to happen.

6208
(Pdb) p g.app.gui.widget_name(w)
'head'   ########### Ooooops.  we are about to select the dead headline
widget.
(Pdb) w
  c:\leo.repo\trunk\leo\core\runleo.py(558)<module>()
-> run()
  c:\leo.repo\trunk\leo\core\runleo.py(112)run()
-> g.app.gui.runMainLoop()
  c:\leo.repo\trunk\leo\plugins\qtgui.py(3887)runMainLoop()
-> sys.exit(self.qtApp.exec_())
  c:\leo.repo\trunk\leo\plugins\qtgui.py(4725)eventFilter()
-> ret = k.masterKeyHandler(leoEvent,stroke=stroke)
  c:\leo.repo\trunk\leo\core\leokeys.py(3332)masterKeyHandler()
-> return k.getArg(event,stroke=stroke)
  c:\leo.repo\trunk\leo\core\leokeys.py(3127)getArg()
-> if handler: handler(event)

c:\leo.repo\trunk\leo\core\leoeditcommands.py(7589)searchWithPresentOptions()
-> self.generalSearchHelper(k.arg)
  c:\leo.repo\trunk\leo\core\leoeditcommands.py(7452)generalSearchHelper()
-> c.widgetWantsFocusNow(self.w)
  c:\leo.repo\trunk\leo\core\leocommands.py(6382)widgetWantsFocusNow()
-> c.outerUpdate()
> c:\leo.repo\trunk\leo\core\leocommands.py(6203)outerUpdate()
-> c.set_focus(w)

Note how deep we are in the call stack, and how unlikely it is that we can
do anything useful here.

So more invention is needed.  It looks like the find setup logic must be
very careful not to select headline widgets!

This shows, yet again, in case anyone remains skeptical, just how tricky it
is to deal with native widgets.  No amount of refactoring, or
"simplification" will help.  You just have to love fixing bugs :-)  Happily,
that would be me.

Edward

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to