NullPointerException on Dynamic Window Resize in Processing
@tudasamenc đang làm issue này rồi.
Từ ngày 10/7/2025.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Most appropriate sub-area of Processing 4?
Core/Environment/Rendering
Processing version
4.4.4
Operating system
Windows 10
Steps to reproduce this
1. Description :
When dynamically resizing a Processing sketch window (via surface.setSize(w, h) or by enabling surface.setResizable(true)), a NullPointerException may occur in Component$BltBufferStrategy.revalidate(...), due to an internal backBuffers[] array being null.
This happens during the rendering phase, likely due to an invalidated or uninitialized BufferStrategy after the resize.
2. Example Stack Trace :
java.lang.NullPointerException: Cannot invoke "java.awt.image.VolatileImage.validate(java.awt.GraphicsConfiguration)" because "this.backBuffers[...]" is null
at java.desktop/java.awt.Component$BltBufferStrategy.revalidate(Component.java:4552)
at java.desktop/java.awt.Component$BltBufferStrategy.getDrawGraphics(Component.java:4449)
at processing.awt.PSurfaceAWT.render(PSurfaceAWT.java:242)
at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1389)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)
3. Expected Behavior :
When resizing the window, either manually (with setResizable(true)) or programmatically (via surface.setSize(w, h)), the sketch should continue rendering smoothly without crashing or throwing an exception.
snippet
// Paste your code below :)
void setup() {
size(600, 400);
surface.setResizable(true);
}
void draw() {
background(200);
}
Additional context
Discovered Workaround :
Calling surface.setVisible(true) immediately after resizing prevents the crash :
surface.setSize(w, h);
surface.setVisible(true); // Prevents the NPE
Would you like to work on the issue?
No
- Ngôn ngữ chính
- Java
- Star
- 497
- Fork
- 183
- Merge trung bình
- 4 giờ 39 phút
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của processing/processing4
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
processing/processing4#1554 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
processing/processing4#1515 · 1 reaction ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
processing/processing4#1573 ·
-
startup error Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
processing/processing4#1569 · 7 bình luận ·
-
Binaries under bin directory lack executable permissions for the snap and .deb packages for Linux Đang mởbug
processing/processing4#1567 · 3 bình luận · 1 reaction · 1 người được giao ·
Tất cả issue của processing/processing4
Issue tương tự
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Đang mởarea/plugin
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
kestra-io/plugin-kestra#190 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
Add canonical URLs and a sitemap Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
apache/rocketmq-dashboard#5064 ·
-
Consent portal: creating a duplicate Purpose shows a generic error instead of "already exists" Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
wso2/dpdp-accelerator#287 ·