PDA

View Full Version : crashing in QCoreApplicationPrivate::sendPostedEvents



er.soni.himanshu
12th April 2016, 09:06
How we should call QCoreApplication::processEvents and what is the importance of that call in application.
my application is crashing in QCoreApplicationPrivate::sendPostedEvents(receiver , event_type, data); frequently which is called inside proceesEvents function.

can you suggest/advise how can i get resolve from that issue.

anda_skoa
12th April 2016, 10:21
How we should call QCoreApplication::processEvents and what is the importance of that call in application.

Why do you want to call the function at all?
Usually an application just start the event loop by calling QCoreApplication::exec().

Cheers,
_

er.soni.himanshu
12th April 2016, 11:45
Thanks for your response. but if we call that function explicitly. is there any advantage or disadvantage ?

Actually my application is getting crashed in QCoreApplicationPrivate::sendPostedEvents and not able to analyses what could be a reason for that .
1). I am using QtcpSocket in my code and using write call for transmitting data frequently. is there any limit/frequency for writing data on socket.
2). should be use waitForBytesWritten() function after every write call ?.
Can Anybody help .

anda_skoa
12th April 2016, 12:43
Thanks for your response. but if we call that function explicitly. is there any advantage or disadvantage ?

The main question is still why you want to call it explicitly.
But if you absolutely must, be aware that this processes events (obviously) and could lead to a code path being executed that ends up right there again.

A bit like reentrancy.



1). I am using QtcpSocket in my code and using write call for transmitting data frequently. is there any limit/frequency for writing data on socket.

That will likely depend on the system and the hardware.



2). should be use waitForBytesWritten() function after every write call ?.

Only if you want to block the caller until the data is written.
Usually you don't want to do that.

I have to say I am bit puzzled by such basic questions coming from someone who, according to the profile, has experience with three major versions of Qt and two language bindings, potentially additional to C++.

Cheers,
_