public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
From: Jon TURNEY <jon.turney@dronecode.org.uk>
To: cygwin-xfree@cygwin.com
Cc: Yaakov Selkowitz <yselkowitz@cygwin.com>
Subject: Re: Cannot run Qt5 applications.
Date: Fri, 13 Feb 2015 18:32:00 -0000 [thread overview]
Message-ID: <54DE4334.9060101@dronecode.org.uk> (raw)
In-Reply-To: <54D2CA12.5080701@dronecode.org.uk>
[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]
On 05/02/2015 01:40, Jon TURNEY wrote:
> On 04/02/2015 23:20, David Stacey wrote:
>> I'm having difficulty running any Qt5 application. These are the
>> commands I'm issuing:
>>
>> XWin -multiwindow &
>> export DISPLAY=:0.0
>> xclock &
>>
>> and I see the clock, so X is up and running. Then:
>>
>> /usr/lib/qt5/examples/gui/analogclock/analogclock
>> QXcbConnection: XCB error: 145 (Unknown), sequence: 162, resource
>> id: 0, major c
>> ode: 140 (Unknown), minor code: 20
>> Bad system call (core dumped)
>
> Possibly you need to install and start cygserver (See [1])
>
> If so, this is because Qt5 is assuming shared memory is available, which
> could possibly be handled in a better way...
>
> [1] http://x.cygwin.com/docs/ug/using-shared-memory.html
Yaakov,
This looks like a portability problem in Qt5, where it only handles
shmget() failing with a return value of -1, not with SIGSYS, to fallback
to using an image in unshared memory.
Patch attached.
--
Jon TURNEY
Volunteer Cygwin/X X Server maintainer
[-- Attachment #2: qt5-shm.patch --]
[-- Type: text/plain, Size: 2318 bytes --]
--- origsrc/qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbbackingstore.cpp 2014-09-11 11:48:06.000000000 +0100
+++ src/qtbase-opensource-src-5.3.2/src/plugins/platforms/xcb/qxcbbackingstore.cpp 2015-02-13 17:30:11.410525500 +0000
@@ -75,6 +75,7 @@ public:
private:
void destroy();
+ static bool isShmSupported();
xcb_shm_segment_info_t m_shm_info;
@@ -88,6 +89,44 @@ private:
QRegion m_dirty;
};
+static bool shmNotSupported = false;
+
+static void
+SigSysHandler(int signo)
+{
+ shmNotSupported = true;
+}
+
+bool
+QXcbShmImage::isShmSupported()
+{
+ static bool checked = false;
+ if (!checked)
+ {
+ void (*oldHandler)(int);
+ int shmid = -1;
+
+ /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
+ oldHandler = signal(SIGSYS, SigSysHandler);
+
+ shmNotSupported = false;
+ shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
+ if (shmid != -1)
+ {
+ /* Successful allocation - clean up */
+ shmctl(shmid, IPC_RMID, NULL);
+ }
+ else
+ {
+ /* Allocation failed */
+ shmNotSupported = true;
+ }
+ signal(SIGSYS, oldHandler);
+ checked = true;
+ }
+ return (!shmNotSupported);
+}
+
QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format)
: QXcbObject(screen->connection())
, m_gc(0)
@@ -116,7 +155,9 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *s
if (!segmentSize)
return;
- int id = shmget(IPC_PRIVATE, segmentSize, IPC_CREAT | 0600);
+ int id = -1;
+ if (isShmSupported())
+ id = shmget(IPC_PRIVATE, segmentSize, IPC_CREAT | 0600);
if (id == -1)
qWarning("QXcbShmImage: shmget() failed (%d) for size %d (%dx%d)",
errno, segmentSize, size.width(), size.height());
@@ -130,7 +171,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *s
xcb_generic_error_t *error = NULL;
if (shm_present)
error = xcb_request_check(xcb_connection(), xcb_shm_attach_checked(xcb_connection(), m_shm_info.shmseg, m_shm_info.shmid, false));
- if (!shm_present || error) {
+ if (!shm_present || error || (id == -1)) {
free(error);
shmdt(m_shm_info.shmaddr);
[-- Attachment #3: Type: text/plain, Size: 223 bytes --]
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/
next prev parent reply other threads:[~2015-02-13 18:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-04 23:20 David Stacey
2015-02-05 1:40 ` Jon TURNEY
2015-02-06 14:57 ` David Stacey
2015-02-13 18:32 ` Jon TURNEY [this message]
2015-03-02 23:34 ` Yaakov Selkowitz
2015-03-03 9:04 ` Corinna Vinschen
2015-03-03 14:49 ` Jon TURNEY
2015-03-03 17:11 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54DE4334.9060101@dronecode.org.uk \
--to=jon.turney@dronecode.org.uk \
--cc=cygwin-xfree@cygwin.com \
--cc=yselkowitz@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).