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

List:       kmail-devel
Subject:    Re: Bug#22749: SEGV in imap kioslave on Solaris
From:       Waldo Bastian <bastian () kde ! org>
Date:       2001-03-21 21:42:19
[Download RAW message or body]

On Wednesday 21 March 2001 10:21, Jan de Visser wrote:
> Did some poking around, and figured out that the problem is that basically
> the following happends:
>
>     QString foo;
>     ...
>     qDebug( "foo: %s", foo.latin1() );
>
> When you delve into the qt code, instantiating a QString like this gives
> you a string object with a NULL character buffer. latin1() then returns
> NULL as well, and Solaris barfs on that.
>
> So the question is:
> 1. Is that the wanted behaviour? I would think that 'QString foo' gives me
> an empty string ("") not a NULL string.

Yes, that's how QString works :-]

> 2. Why does it work on Linux? Is Linus more forgiving here??

Yes. The correct code would be something like:

qDebug("foo: %s", foo.latin1() ? foo.latin1 : "<null>");

or prefered:

kdDebug(7116) << "foo: " << foo << endl;

Where 7116 should be registered in kdelibs/kdecore/kdebug.areas as belonging 
to kio_imap.

Cheers,
Waldo
-- 
bastian@kde.org | SuSE Labs KDE Developer | bastian@suse.com
_______________________________________________
Kmail Developers mailing list
Kmail@master.kde.org
http://master.kde.org/mailman/listinfo/kmail

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

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