[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Segfault Bug in KURL
From: David Faure <david () mandrakesoft ! com>
Date: 2002-02-27 15:36:44
[Download RAW message or body]
On Wednesday 27 February 2002 14:41, Benjamin Meyer wrote:
> He is the sinario:
>
> This caused a segfault for me:
> void foo(KURL url){
> KURL *p = newKURL(url);
> }
KURL is usually built on the stack (KURL blah) rather than on the heap (new).
When passing as parameter, prefer to pass objects by reference than by value.
> This didn't:
> void foo(KURL url){
> KURL *p = newKURL();
> p->setPath(url->path());
> }
This can't compile (url is an object, and you access it with "->").
and to set a URL to another one, just KURL a = b;
There isn't enough code here to see what could possibly be crashing anyway,
but those uses of pointers make it likely that you have an unset pointer somewhere.
--
David FAURE, david@mandrakesoft.com, faure@kde.org
http://people.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic