<AWT Dev> [JDK-8171000]Robot.createScreenCapture() crashes in wayland mode
Jayathirth D V
jayathirth.d.v at oracle.com
Fri Feb 9 04:00:55 UTC 2018
FYI. Build is failing on OEL7 also.
/workspace/open/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c:405:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
jib > for (image_region_type* reg = (image_region_type *) first_in_list( regions); reg;
/workspace/open/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c:409:17: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
jib > for (int32_t rect = 0; rect < vis_reg->numRects; rect++)
From: Sergey Bylokhov
Sent: Friday, February 09, 2018 5:59 AM
To: Krishna Addepalli; awt-dev at openjdk.java.net
Subject: Re: <AWT Dev> [JDK-8171000]Robot.createScreenCapture() crashes in wayland mode
Actually it breaks the build on solaris sparc, please fix it:
line 405: error: declaration statement is not allowed in for-loop initialization (E_DECLARATION_IN_FOR) jib > "/work_dir/49831a9a-88b9-4acc-a9f6-f21c977aa801/workspace/open/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c",
line 409: error: declaration statement is not allowed in for-loop initialization (E_DECLARATION_IN_FOR) jib > cc: acomp failed for /work_dir/49831a9a-88b9-4acc-a9f6-f21c977aa801/workspace/open/src/java.desktop/unix/native/libawt_xawt/awt/multiVis.c
jib > make: ***
On 04/02/2018 20:29, Sergey Bylokhov wrote:
> OK, then it looks fine.
> On 03/02/2018 20:13, Krishna Addepalli wrote:
>> Hi Sergey,
>> I'm aware of the C99 thing, so I looked around in the file before
>> making those changes. For example, within the same function that I
>> modified, I found variable declarations inside the for loop:
>> for (reg = (image_region_type *) first_in_list( regions); reg;
>> reg = (image_region_type *) next_in_list( regions))
>> int32_t rect;
>> struct my_XRegion *vis_reg;
>> And also, in couple of other places within the same file, the some
>> variables were declared within if blocks. That's when I moved the
>> variable declarations to the point of use.
>> -----Original Message-----
>> From: Sergey Bylokhov
>> Sent: Saturday, February 3, 2018 1:27 PM
>> To: Krishna Addepalli <krishna.addepalli at oracle.com>;
>> awt-dev at openjdk.java.net
>> Subject: Re: <AWT Dev> [JDK-8171000]Robot.createScreenCapture()
>> crashes in wayland mode
>> Hi, Krishna.
>> The change of local types declarations looks reasonable, but I am not
>> sure that C99 will be supported by all compilers which will be used
>> to build jdk where this fix will be used.
>> I suggest to simplify the fix and add only one null check to it.
>> On 01/02/2018 04:06, Krishna Addepalli wrote:
>>> Hi All,
>>> Please review a fix for JDK-8171000:
>>> Webrev: http://cr.openjdk.java.net/~kaddepalli/8171000/webrev00/
>>> The crash happens since XGetImage can return NULL in case of
>>> Wayland, which doesnot permit reading screen pixels outside the owning window.
>>> Added a null check to prevent the same, and also refactored and
>>> removed unnecessary code to make the function simpler.
>> Best regards, Sergey.
Best regards, Sergey.
More information about the awt-dev