[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kant
Subject:    [Kde-kant] Re: kwirte crashes on Shift+CTRL+Left Arrow
From:       Ellis Whitehead <kde () ellisw ! net>
Date:       2001-06-11 0:16:12
[Download RAW message or body]

I've submitted a patch to fix the problem.  At least it's not crashing on my 
system anymore.

Since I'm not a kate initiate, here's my reasoning for someone more 
knowledgable to check:

The problem was with Highlight::deliminatorLen.  It seems to be left 
uninitialized when opening a document without a default highlighting mode -- 
Highlight::Highlight() is passed a null pointer, and deliminatorLen is left 
containing junk.  Just initializing deliminator to zero wouldn't work, 
because then Highlight::isInWord always returns false, which would mean that 
KateViewInternal::wordLeft() would always take the cursor to x=0.

So my patch just moved the deliminator* initiations below the 'else' 
statement.

Regards,
Ellis

--------------

bool Highlight::isInWord(QChar c)
{
  return !ustrchr(deliminatorChars, deliminatorLen, c);
}

Highlight::Highlight(syntaxModeListItem *def) : refCount(0)
{
  noHl = false;

  if (def == 0)
  {
    noHl = true;
    iName = I18N_NOOP("Normal");
    iSection = "";
  }
  else
  {
    iName = def->name;
    iSection = def->section;
    iWildcards = def->extension;
    iMimetypes = def->mimetype;
    identifier = def->identifier;
    deliminator = stdDeliminator;
    deliminatorChars = deliminator.unicode();
    deliminatorLen = deliminator.length();
  }
}


---------------
void KateViewInternal::wordLeft(VConfig &c) {
  Highlight *highlight;

  highlight = myDoc->highlight();
  TextLine::Ptr textLine = myDoc->getTextLine(cursor.y);

  kdDebug() << "cursor.x = " << cursor.x << "textLine = " << 
(QString)(*textLine) << endl;

  if (cursor.x > 0) {
    do {
      cursor.x--;
    } while (cursor.x > 0 && 
!highlight->isInWord(textLine->getChar(cursor.x)));
    while (cursor.x > 0 && highlight->isInWord(textLine->getChar(cursor.x 
-1)))
      cursor.x--;
  } else {
    if (cursor.y > 0) {
      cursor.y--;
      textLine = myDoc->getTextLine(cursor.y);
      cursor.x = textLine->length();
    }
  }

  cOldXPos = cXPos = myDoc->textWidth(cursor);
  changeState(c);
}

http://master.kde.org/mailman/subscribe/kde-kant

On Sunday 10 June 2001 17:23, Ellis Whitehead wrote:
> Also, it only crashes on small files.
>
> to recreate:
> Open a new file, enter in some text, and press Ctrl+Shift+Left.
>
> I'm looking at fixing it now...
>
> Ellis
>
> On Sunday 10 June 2001 15:45, Ferdinand Gassauer wrote:
> > Hi!
> > here is the BT
> >
> > 0x40dd05a9 in __wait4 () from /lib/libc.so.6
> > #0  0x40dd05a9 in __wait4 () from /lib/libc.so.6
> > #1  0x40e38ad8 in __DTOR_END__ () from /lib/libc.so.6
> > #2  0x405debb5 in KCrash::defaultCrashHandler (signal=11) at
> > kcrash.cpp:197 #3  <signal handler called>
> > #4  QChar::QChar (this=0xbfffe958, c=@0x0)
> >     at /d2/src/gassauer.cvs/kde2/qt-copy/include/qstring.h:234
> > #5  0x40f091e0 in ustrchr (s=0x0, len=2013277696, c={static null = {
> >         static null = <same as static member of an already seen type>,
> >         static replacement = {
> >           static null = <same as static member of an already seen type>,
> >           static replacement = <same as static member of an already seen
> > type>, static byteOrderMark = {
> >             static null = <same as static member of an already seen
> > type>, static replacement = <same as static member of an already seen
> > type>, static byteOrderMark = <same as static member of an already seen
> > type>,
> >             static byteOrderSwapped = {
> >               static null = <same as static member of an already seen
> > type>, static replacement = <same as static member of an already seen
> > type>, static byteOrderMark = <same as static member of an already seen
> > type>,
> >               static byteOrderSwapped = <same as static member of an
> > already seen type>, static nbsp = {
> >                 static null = <same as static member of an already seen
> > type>,
> >                 static replacement = <same as static member of an already
> > seen type>, static byteOrderMark = <same as static member of an already
> > seen type>,
> >                 static byteOrderSwapped = <same as static member of an
> > already seen type>, static nbsp = <same as static member of an already
> > seen type>,
> >                 rw = 0 '\000', cl = 160 ' '}, rw = 255 'ÿ', cl = 254
> > 'þ'}, static nbsp = <same as static member of an already seen type>, rw =
> > 254 'þ', cl = 255 'ÿ'},
> >           static byteOrderSwapped = <same as static member of an already
> > seen type>, static nbsp = <same as static member of an already seen
> > type>, rw = 255 'ÿ', cl = 253 'ý'},
> >         static byteOrderMark = <same as static member of an already seen
> > type>, static byteOrderSwapped = <same as static member of an already
> > seen type>,
> >         static nbsp = <same as static member of an already seen type>,
> >         rw = 0 '\000', cl = 0 '\000'},
> >       static replacement = <same as static member of an already seen
> > type>, static byteOrderMark = <same as static member of an already seen
> > type>, static byteOrderSwapped = <same as static member of an already
> > seen type>, static nbsp = <same as static member of an already seen
> > type>, rw = 140 '\214', cl = 233 'é'}) at katehighlight.cpp:70
> > #6  0x40f0d747 in Highlight::isInWord (this=0x80bf6f0, c={static null = {
> >         static null = <same as static member of an already seen type>,
> >         static replacement = {
> >           static null = <same as static member of an already seen type>,
> >           static replacement = <same as static member of an already seen
> > type>, static byteOrderMark = {
> >             static null = <same as static member of an already seen
> > type>, static replacement = <same as static member of an already seen
> > type>, static byteOrderMark = <same as static member of an already seen
> > type>,
> >             static byteOrderSwapped = {
> >               static null = <same as static member of an already seen
> > type>, static replacement = <same as static member of an already seen
> > type>, static byteOrderMark = <same as static member of an already seen
> > type>,
> >               static byteOrderSwapped = <same as static member of an
> > already seen type>, static nbsp = {
> >                 static null = <same as static member of an already seen
> > type>,
> >                 static replacement = <same as static member of an already
> > seen type>, static byteOrderMark = <same as static member of an already
> > seen type>,
> >                 static byteOrderSwapped = <same as static member of an
> > already seen type>, static nbsp = <same as static member of an already
> > seen type>,
> >                 rw = 0 '\000', cl = 160 ' '}, rw = 255 'ÿ', cl = 254
> > 'þ'}, static nbsp = <same as static member of an already seen type>, rw =
> > 254 'þ', cl = 255 'ÿ'},
> >           static byteOrderSwapped = <same as static member of an already
> > seen type>, static nbsp = <same as static member of an already seen
> > type>, rw = 255 'ÿ', cl = 253 'ý'},
> >         static byteOrderMark = <same as static member of an already seen
> > type>, static byteOrderSwapped = <same as static member of an already
> > seen type>,
> >         static nbsp = <same as static member of an already seen type>,
> >         rw = 0 '\000', cl = 0 '\000'},
> >       static replacement = <same as static member of an already seen
> > type>, static byteOrderMark = <same as static member of an already seen
> > type>, static byteOrderSwapped = <same as static member of an already
> > seen type>, static nbsp = <same as static member of an already seen
> > type>, rw = 196 'Ä',
> >       cl = 233 'é'}) at katehighlight.cpp:1044
> > #7  0x40f2d517 in KateViewInternal::wordLeft (this=0x80de108,
> > c=@0xbfffea2c) at kateview.cpp:334
> > #8  0x40f2ce22 in KateViewInternal::doCursorCommand (this=0x80de108,
> >     c=@0xbfffea2c, cmdNum=2) at kateview.cpp:188
> > #9  0x40f34c16 in KateView::doCursorCommand (this=0x80ddc48, cmdNum=2)
> >     at kateview.cpp:2061
> > #10 0x40f66a15 in KateView::shiftWordLeft (this=0x80ddc48) at
> > kateview.h:621 #11 0x40f330ea in KateView::keyPressEvent (this=0x80ddc48,
> > ev=0xbfffec14) at kateview.cpp:1597
> > #12 0x4088cb3f in QWidget::event ()
> >    from /d2/src/gassauer.cvs/kde2/qt-copy/lib/libqt.so.2
> > #13 0x407f42cb in QApplication::notify ()
> >    from /d2/src/gassauer.cvs/kde2/qt-copy/lib/libqt.so.2
> > #14 0x405918f6 in KApplication::notify (this=0x805c348,
> > receiver=0x80de108, event=0xbfffec14) at kapp.cpp:524
> > #15 0x407c5c81 in QETWidget::translateKeyEvent ()
> >    from /d2/src/gassauer.cvs/kde2/qt-copy/lib/libqt.so.2
> > #16 0x407c1b91 in QApplication::x11ProcessEvent ()
> >    from /d2/src/gassauer.cvs/kde2/qt-copy/lib/libqt.so.2
> > #17 0x407c0d61 in QApplication::processNextEvent ()
> >    from /d2/src/gassauer.cvs/kde2/qt-copy/lib/libqt.so.2
> > #18 0x407f603f in QApplication::enter_loop ()
> >    from /d2/src/gassauer.cvs/kde2/qt-copy/lib/libqt.so.2
> > #19 0x407c0cdb in QApplication::exec ()
> >    from /d2/src/gassauer.cvs/kde2/qt-copy/lib/libqt.so.2
> > #20 0x4067c7c4 in main (argc=7, argv=0x8059e20) at kwritemain.cpp:545
> > #21 0x804e399 in launch (argc=7, _name=0x8059cb4 "kwrite",
> >     args=0x8059cf2 "\001", cwd=0x0, envc=1, envs=0x8059d03 "",
> >     reset_env=false, tty=0x0, avoid_loops=false,
> >     startup_id_str=0x8059d07 "linuxfg2;992201707;175733;25091")
> >     at kinit.cpp:462
> > #22 0x804f2b7 in handle_launcher_request (sock=6) at kinit.cpp:905
> > #23 0x804f93f in handle_requests (waitForPid=0) at kinit.cpp:1067
> > #24 0x80508b6 in main (argc=7, argv=0xbffff4f4, envp=0xbffff514)
> >     at kinit.cpp:1365
> > #25 0x40d47baf in __libc_start_main () from /lib/libc.so.6
> >
> >> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to
> >> unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic