[Interest] QtThread
George Tasopoulos
tasopoulos.yorghos at gmail.com
Tue Jan 21 11:36:45 CET 2014
You're right. I've not read the docs in a while and remembered it wrong.
---
Yours sincerely,
George Tasopoulos
On 21 Jan 2014 10:05, "Etienne Sandré-Chardonnal" <etienne.sandre at m4x.org>
wrote:
> I don't see what is complicated here?
>
> if( (QObject*)targetThread==(QObject*)this )
> {
> qWarning("That's wrong');
> return;
> }
>
> Etienne
>
>
> 2014/1/21 George Tasopoulos <tasopoulos.yorghos at gmail.com>
>
>> Would it even be possible to check for such a thing? moveToThread accepts
>> a pointer to a QObject, and this pointer is passed by value. How could the
>> function know whether this value was given to it as "QObject* pObject" or
>> "QObject* this"?
>> Does Qt have a way to check code before it's given to the compiler?
>>
>> ---
>> Yours sincerely,
>> George Tasopoulos
>> On 21 Jan 2014 09:44, "Bo Thorsen" <bthorsen at ics.com> wrote:
>>
>>> Den 20-01-2014 17:32, Thiago Macieira skrev:
>>> > On segunda-feira, 20 de janeiro de 2014 12:41:33, Bo Thorsen wrote:
>>> >> I have just created a suggestion in the bug tracker to make it illegal
>>> >> to do moveToThread(this):
>>> >>
>>> >> https://bugreports.qt-project.org/browse/QTBUG-36278
>>> >>
>>> >> It can't be said often enough: Don't do this! But if it was illegal
>>> >> behaviour, we wouldn't have to say it.
>>> >
>>> > Because it's not illegal to do it. It's just a bad idea in most cases.
>>>
>>> This is true, and I do see the point. If someone can actually point to a
>>> reasonable use case for it. If not, I would still choose to make it
>>> illegal.
>>>
>>> I have seen moveToThread(this) many times and every single one of them
>>> was wrong. To me this suggests that it might be better to protect new Qt
>>> developers instead of handing them a tool they only use to shoot
>>> themselves in the foot with.
>>>
>>> > I'd rather not add a check for things you shouldn't do but that might
>>> still
>>> > work nonetheless. That's wasted CPU cycles for people who did the
>>> right thing.
>>>
>>> This point I won't just take, though. moveToThread is not an operation
>>> that will be used often, so optimization is almost irrelevant. Well, I
>>> certainly hope that noone does moveToThread a lot :)
>>>
>>> Anyway, it's not my decision. I'll argue the case because I think it's
>>> the right thing to do, but it's not important to me.
>>>
>>> Bo.
>>>
>>> --
>>> Bo Thorsen, European Engineering Manager, ICS
>>> Integrated Computer Solutions. Delivering World-Class Applications
>>> http://ics.com/services
>>> _______________________________________________
>>> 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/20140121/87d2b26d/attachment.html>
More information about the Interest
mailing list