1 Star 0 Fork 12

莫比乌斯/openjdk-21

forked from src-openEuler/openjdk-21 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Backport-JDK-8336879-Always-true-condition-img-null-.patch 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
wuyafang 提交于 2024-10-14 11:38 . sync bishengjdk21 patches
Subject: Backport JDK-8336879 Always true condition 'img != null' in GTKPainter.paintPopupMenuBackground
---
.../classes/com/sun/java/swing/plaf/gtk/GTKPainter.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
index 1635ff66f..6231e11d6 100644
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -610,10 +610,10 @@ class GTKPainter extends SynthPainter {
x + insets.left, y + insets.top, w - insets.left - insets.right,
h - insets.top - insets.bottom);
BufferedImage img = ENGINE.finishPainting();
- if(!isHW) {
+ if (!isHW && img != null) {
int border = img.getRGB(0, h / 2);
- if (img != null && border == img.getRGB(w / 2, h / 2)) {
- // fix no menu borders in Adwaita theme
+ if (border == img.getRGB(w / 2, h / 2)) {
+ // fix no menu borders
Graphics g2 = img.getGraphics();
Color c = new Color(border);
g2.setColor(new Color(Math.max((int) (c.getRed() * 0.8), 0),
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/neu-mobi/openjdk-21.git
git@gitee.com:neu-mobi/openjdk-21.git
neu-mobi
openjdk-21
openjdk-21
master

搜索帮助