Re: qt terminal behavior if no x11 is available

Daniel J Sebald <[email protected]>
Newsgroups gmane.comp.graphics.gnuplot.devel
Message-ID <[email protected]>
On 11/8/20 4:27 AM, Dima Kogan wrote:
> Hi. Is anybody here familiar with the qt terminal init sequence? I'm
> observing that if you try to plot anything without DISPLAY defined, the
> qt terminal throws an error and hangs. It does NOT give us the prompt
> back. This confuses tools that use gnuplot to make plots.
> 
> There was a commit that changed the way this works:
> 
>    https://sourceforge.net/p/gnuplot/gnuplot-main/ci/c415285c230
> 
> Reverting that makes gnuplot give up after a few seconds. The x11 and
> wxt terminals figure it out immediately, but even a wait of several
> seconds is better than a forever hang we currently get. Is there a
> better way to handle errors in qt?
> 
> Thanks!
> 

https://doc.qt.io/qt-5/qlocalsocket.html#waitForConnected

https://doc.qt.io/qt-5/qlocalsocket.html#error

https://doc.qt.io/qt-5/qlocalsocket.html#LocalSocketError-enum

That polling loop approach isn't really what should be done.  By doing 
so it kind of obviates the error test.  In the least, what this polling 
loop should be doing checking the error() after the failure to connect 
and going to sleep to determine if the error was a 
QLocalSocket::SocketTimeoutError.  If it was some other type of error, 
don't continue waiting.

     QLocalSocket::LocalSocketError err = qt->socket.error();
     if (err != QLocalSocket::SocketTimeoutError)
         break;

and of course don't wait forever.

As for the comment:

	// The QLocalSocket::waitForConnected does not respect the time out 
argument when
	// the gnuplot_qt application is not yet started or has not yet 
self-initialized.
	// To wait for it, we need to implement the timeout ourselves

one just needs to figure out how to put this in the context of an event 
loop, i.e., start an event loop.  That could be done with threading and 
the exec() routine.

Dan


_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.