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

List:       kde-devel
Subject:    Re: porting from kde 1.x to 3.x
From:       David Bishop <tech () bishop ! dhs ! org>
Date:       2002-07-31 23:18:53
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 29 July 2002 05:38 pm, Rob Kaper wrote:
> On Tuesday 30 July 2002 01:09, David Bishop wrote:
> Wouldn't this also work:
>
> QStringList errors = QStringList::split( "\n", QString::fromLocal8Bit(
> buffer, buflen ));
>
> and in the loop error_listbox->insertItem(*it);
>
> (of course one should check for a valid *it as well, by adding && (*it) to
> the loop condition)
>
> Rob

Well, it *should* work :-)  However, when I force an error in xmame, 
I get a crash in kmame, with the following to stdout (and bt attached):

ASSERT: "it.node != node" in /usr/include/qt/qvaluelist.h (274)

My code now looks like this:

void MainDialog::ReadStderr(KProcess *, char *buffer, int buflen)
{

    QString s = QString::fromLocal8Bit( buffer, buflen );
    QStringList errors = QStringList::split( "\n", s );

    if ( !m_str.isEmpty() ) {
      errors.first().prepend(m_str);
      m_str = QString::null;
    }

    if ( s.at(buflen) != '\n' ) {
      m_str = errors.last();
      errors.pop_back();
    }

    for ( QStringList::Iterator it = errors.begin() ; (it != errors.end() && (*it)); ++it ) {
         error_listbox->insertItem(*it);
    }

    error_listbox->setBottomItem(error_listbox->count());
}

I've also tried replacing the s.at(buflen) with s.at(s.length()) but that didn't seem to 
affect anything </wag>.

Ideas?

- -- 
A mouse is a device used to point at the xterm you want to type in. 
  --Kim Alm, a.s.r 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9SHBfEHLN/FXAbC0RAqwHAKCvYtMc34Bcq5T+8eDYXCZ+1E2qZwCgsoOR
3hPbrkotZxvcpuYHhgxJwCQ=
=929r
-----END PGP SIGNATURE-----

["kmame.bt" (text/plain)]

[New Thread 1024 (LWP 23080)]
0x40c60899 in wait4 () from /lib/libc.so.6
#0  0x40c60899 in wait4 () from /lib/libc.so.6
#1  0x40cd6dd0 in __check_rhosts_file () from /lib/libc.so.6
#2  0x40b96447 in waitpid () from /lib/libpthread.so.0
#3  0x4031c120 in KCrash::defaultCrashHandler () from /usr/lib/libkdecore.so.4
#4  0x40b93f54 in pthread_sighandler () from /lib/libpthread.so.0
#5  0x40be9678 in sigaction () from /lib/libc.so.6
#6  0x0805936f in QString::operator char const * (this=0x30)
    at /usr/include/qt/qstring.h:564
#7  0x0805edff in MainDialog::ReadStderr (this=0x812fa40, 
    buffer=0xbfffec9c "\n(XDGASync)e of failed request:  216", buflen=1)
    at maindialog.cpp:246
#8  0x0806a0dc in MainDialog::qt_invoke (this=0x812fa40, _id=44, _o=0xbfffec1c)
    at maindialog.moc.cpp:137
#9  0x40654933 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#10 0x402d04b3 in KProcess::receivedStderr () from /usr/lib/libkdecore.so.4
#11 0x402cf01c in KProcess::childError () from /usr/lib/libkdecore.so.4
#12 0x402cee7b in KProcess::slotChildError () from /usr/lib/libkdecore.so.4
#13 0x402d05ec in KProcess::qt_invoke () from /usr/lib/libkdecore.so.4
#14 0x402d0814 in KShellProcess::qt_invoke () from /usr/lib/libkdecore.so.4
#15 0x08069787 in MyProcess::~MyProcess (this=0x81a31d0, __in_chrg=3)
    at myprocess.moc.cpp:28
#16 0x40654933 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#17 0x40654a45 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#18 0x40904d87 in QSocketNotifier::activated () from /usr/lib/libqt-mt.so.3
#19 0x4066b07e in QSocketNotifier::event () from /usr/lib/libqt-mt.so.3
#20 0x405f74e3 in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#21 0x405f7384 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#22 0x40290354 in KApplication::notify () from /usr/lib/libkdecore.so.4
#23 0x405a068b in qt_set_socket_handler () from /usr/lib/libqt-mt.so.3
#24 0x405a0e47 in QApplication::processNextEvent () from /usr/lib/libqt-mt.so.3
#25 0x405f8921 in QApplication::enter_loop () from /usr/lib/libqt-mt.so.3
#26 0x405a06f7 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#27 0x08068f3d in PrefGeneral::className (this=0x1) at prefgeneral.moc.cpp:24
#28 0x40bd914f in __libc_start_main () from /lib/libc.so.6

>> Visit http://mail.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