[KDE-India] Problem with QHttp

Till Adam adam at kde.org
Sun May 21 17:52:57 CEST 2006


On Friday 19 May 2006 07:38, Aditya Mooley wrote:
> I am trying to write a simple program which fetches the given
> page/image using QHttp.
> But I get a Segmentation fault when this program is executed.
>
> You can find the .cpp and .h files here ->
> http://sanisoft-demo.com/kde/
>
> Please let me know what's going wrong and what will be the correct
> way to do it.
>
> Cheers,

Got it, I think. You'll need to add a:

  if ( requestId != httpGetId ) return;

at the top of: 

void kdeTest::httpRequestFinished(int requestId, bool error)

setHost() schedules a request, and get() schedules the next one. The 
handler is called first for the setHost request, deletes the file 
pointer, which the following attempt to satisfy the get() request 
access. Boom.

Valgrind is a great tool for debugging these kinds of things, btw. It 
showed immediately where the illegal memory access was, and where that 
memory was deleted from.

Cheers.,

Till
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-india/attachments/20060521/248b88b1/attachment.pgp 


More information about the KDE-india mailing list