Skip to content

Prevent pixman warnings by validating rectangle dimensions before region creation#84

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-pixman-invalid-rectangle-warning-again
Draft

Prevent pixman warnings by validating rectangle dimensions before region creation#84
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-pixman-invalid-rectangle-warning-again

Conversation

Copy link

Copilot AI commented Feb 9, 2026

Pixman emits warnings when cairo_region_create_rectangle receives rectangles with zero or negative dimensions, which occurs when widgets are resized to minimal dimensions or when GTK returns invalid GdkRectangle values.

Changes

  • Added validation: isValid() method in cairo_rectangle_int_t checks width > 0 && height > 0
  • Protected region creation: Added validation before all cairo_region_create_rectangle calls:
    • GC.java: cairoClipRegion() and copyArea()
    • Control.java: drawBackground() and cairoClipRegion()
    • Canvas.java: scroll()
    • TextLayout.java: Two text rendering paths

When invalid rectangles are detected, methods return early or skip region operations, preventing the warning while maintaining correct rendering behavior (region clipping is skipped, operations proceed without the invalid region).

cairo_rectangle_int_t cairoRect = new cairo_rectangle_int_t();
cairoRect.convertFromGdkRectangle(rect);
if (!cairoRect.isValid()) return;  // Skip instead of creating invalid region
long actualRegion = Cairo.cairo_region_create_rectangle(cairoRect);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • repo.eclipse.org
    • Triggering command: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.10-7/x64/bin/java /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.10-7/x64/bin/java --enable-native-access=ALL-UNNAMED -classpath /opt/hostedtoolcache/maven/3.9.12/x64/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/opt/hostedtoolcache/maven/3.9.12/x64/bin/m2.conf -Dmaven.home=/opt/hostedtoolcache/maven/3.9.12/x64 -Dlibrary.jansi.path=/opt/hostedtoolcache/maven/3.9.12/x64/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/eclipse.platform.swt/eclipse.platform.swt org.codehaus.plexus.classworlds.launcher.Launcher clean compile -DskipTests -pl bundles/org.eclipse.swt -am (dns block)
  • www.cairographics.org
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Pixman Invalid rectangle warning in console</issue_title>
<issue_description>Running SWT (most notably Eclipse ) sometimes prints
*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

akurtakov and others added 2 commits February 9, 2026 14:18
When size is not known one should pass -1 and not 0
.
Co-authored-by: akurtakov <574788+akurtakov@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Pixman invalid rectangle warning in console Prevent pixman warnings by validating rectangle dimensions before region creation Feb 9, 2026
Copilot AI requested a review from akurtakov February 9, 2026 12:59
@akurtakov akurtakov force-pushed the master branch 3 times, most recently from 45fdafa to e1f8208 Compare March 3, 2026 15:14
@akurtakov akurtakov force-pushed the master branch 10 times, most recently from e005bf8 to e77c3cf Compare March 12, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pixman Invalid rectangle warning in console

2 participants