[Kst] [Bug 124444] Crash when click on where deleted object used to be

Andrew Walker arwalker at sumusltd.com
Wed Mar 29 00:00:46 CEST 2006


I don't think this is the source of the bug as in that case we are in layout 
mode and so it doesn't matter what the value of _pressTarget is.

That said, I agree that the code at line 336 looks wrong.

If the "if" statement was written as intended then the _pressTarget = 0L
inside it is unnecessary. What about the following:

  if (_mode != LayoutMode) {
    _pressTarget = 0L;
    return false;
  }  
  
  _pressTarget = findDeepestChild(pos, false);
  if (_pressTarget) {
    KstViewObjectPtr p = _pressTarget;
    while (p->_parent && p->_parent->_container) {
      p = p->_parent;
    }
    if (p->_parent && !p->_parent->_container) {
      _pressTarget = p->_parent;
    }
  }

  if (!_pressTarget) {
    return false;
  }


On March 28, 2006 1:33 pm, George Staikos wrote:
> On Tuesday 28 March 2006 15:29, Andrew Walker wrote:
> > It crashes in KstTopLevelView::handlePress(const QPoint& pos, bool shift)
> > because _focusOn is true but _pressTarget is NULL
>
> On line 336 I see this:
>   if (_mode != LayoutMode && !_pressTarget) {
>     _pressTarget = 0L;
>     return false;
>   }
>
> I think that might actually be the bug.  I think it should be
> "|| !_pressTarget" because it does all kinds of checking for a null target
> but then completely ignores it without this logic.
>
> ------------------------------------------------------------------------
> r439385 | rchern | 2005-07-27 21:01:57 -0400 (Wed, 27 Jul 2005) | 3 lines
>
> Very preliminary skeleton of graphics view objects UI
> - most features do not work/are buggy
> ------------------------------------------------------------------------
>
> I'm still baffled as to why I don't see this, but I think I see how it
> crashes.  Do you agree that it should be || !_pressTarget?


More information about the Kst mailing list