[Qt-interest] (QtSolutions) SendMessage() of QtSingleApplication retuns
Marc Cals
cpmarc at gmail.com
Tue Mar 8 21:44:18 CET 2011
Hi David,
Thanks for your reply.
Before calling QtSingleApplication::sendMessage() we always call
QtSingleApplication::isRunning(), if isRunning() return true then we call
sendMessage() method, and sometimes this method although the main instance
is responsiveness return false. We believe the problem is that the running
instance close the socket in which receive the message before the new
instance (who sends message) can read the ack confirmation of message
received, because sendMessage method can't read the ack returns false.
With the atthached project I sent in first e-mail the problem can be
reproduced easily
On Mon, Mar 7, 2011 at 2:15 AM, David Ching <dc at dcsoft.com> wrote:
> I had the same issue and debugged it as far as this. I worked around it
> simply by calling QtSingleApplication::isRunning() and only if that returns
> true do I then call QtSingleApplication::sendMessage().
>
> BTW, I had another issue on Windows that asking the previous instance to
> show a window resulted in it's taskbar button flashing, due to Windows
> concept of foreground lock timeout. To workaround that, I first call
> AllowSetForegroundWindow() from the current instance.
>
> -- David
>
>
> -----Original Message-----
>
> Date: Mon, 28 Feb 2011 20:45:09 +0100
> From: Marc <cpmarc at gmail.com>
>
> Hello,
>
> We are using QtSolution QtSingleApplication in our application to have only
> one instance executing. We have discovered that when there is another
> instance runing, in some cases sendMessage (method used to comunicate with
> the main instance) function return false, although the main instance has
> received the message.
>
> Debugging QtSingleApplication we have observed that
> socket.waitForReadyRead(timeout); (line 161) in function sendMessage
> returns
> false sometimes.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110308/7e655398/attachment.html
More information about the Qt-interest-old
mailing list