[Interest] QMap crashing in a thread
BOUCARD Olivier
boucard_olivier at yahoo.fr
Thu Mar 13 22:47:45 CET 2014
The weird thing is that I have debug outputs in my Server destructor and they only appear at the end of the of the application as they should.
When I quit my application without sending a HTTP request.
And if I access my QMap in the destructor I have no problem.
Le Jeudi 13 mars 2014 22h40, Jason H <scorp1us at yahoo.com> a écrit :
I wouldn't think so. as they should have a very good idea of what this is, and that this exists.
>
>
>I would think perhaps you are accessing a deleted object?
>
>
>I've used QMap successfully in similar situations.
>
>
>
>________________________________
> From: BOUCARD Olivier <boucard_olivier at yahoo.fr>
>To: "interest at qt-project.org" <interest at qt-project.org>
>Sent: Thursday, March 13, 2014 4:21 PM
>Subject: Re: [Interest] QMap crashing in a thread
>
>
>
>Hum they do a static_cast before calling the callback:
>
>
>void render_POST(const http_request& req, http_response** res)
>{
>
static_cast<CHILD*>(this)->render_POST(req, res);
>}
>
>
>Maybe is the source of the problem.
>
>
>
>
>Le Jeudi 13 mars 2014 22h16, BOUCARD Olivier <boucard_olivier at yahoo.fr> a écrit :
>
>Thanks Thiago.
>>
>>I'm not sure to understand. QMap::contains is const.
>>So as QMap is re-entrant, in theory QMap::contains should be "thread-safe".
>>And I have no other thread accessing the map at this time.
>>I sent request manually with curl.
>>
>>
>>
>>
>>
>>
>>Le Jeudi 13 mars 2014 22h07, Thiago Macieira <thiago.macieira at intel.com> a écrit :
>>
>>Em qui 13 mar 2014, às 18:52:32, BOUCARD Olivier escreveu:
>>>> I have this Server class with a QMap<QString, MyClass*> object member.
>>>> This server is a HTTP server class using libhttpserver.
>>>> I have also a member function which is called by
libhttpserver when it
>>>> receives a HTTP request. This function is called in a thread created by
>>>>
libhttpserver automatically. And when I try call a function on the QMap
>>>> inside this function I get a Segmentation Fault:
>>>
>>>You probably forgot to lock a mutex before accessing that QMap.
>>>--
>>>Thiago Macieira - thiago.macieira (AT) intel.com
>>> Software Architect - Intel Open Source Technology Center
>>>
>>>
>>>_______________________________________________
>>>Interest mailing list
>>>Interest at qt-project.org
>>>http://lists.qt-project.org/mailman/listinfo/interest
>>>
>>>
>>
>>_______________________________________________
>>Interest mailing list
>>Interest at qt-project.org
>>http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>>
>
>_______________________________________________
>Interest mailing list
>Interest at qt-project.org
>http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140313/80278d7d/attachment.html>
More information about the Interest
mailing list