Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 871ca4d

Browse files
committed
fix sigsev from freeing glfw standard cursors
1 parent a5133e5 commit 871ca4d

File tree

5 files changed

+15
-29
lines changed

5 files changed

+15
-29
lines changed

1.20/src/main/java/io/github/axolotlclient/modules/hud/HudEditScreen.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public class HudEditScreen extends Screen {
5454
private static final BooleanOption snapping = new BooleanOption("snapping", true);
5555
private static final OptionCategory hudEditScreenCategory = OptionCategory.create("hudEditScreen");
5656
private static final int GRAB_TOLERANCE = 5;
57-
private final long MOVE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_ALL_CURSOR);
58-
private final long DEFAULT_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
59-
private final long NWSE_RESIZE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_NWSE_CURSOR),
57+
private static final long MOVE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_ALL_CURSOR);
58+
private static final long DEFAULT_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
59+
private static final long NWSE_RESIZE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_NWSE_CURSOR),
6060
NESW_RESIZE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_NESW_CURSOR);
6161

6262
public static boolean isSnappingEnabled() {
@@ -188,10 +188,6 @@ public void removed() {
188188
setCursor(DEFAULT_CURSOR);
189189
mode = ModificationMode.NONE;
190190
super.removed();
191-
GLFW.glfwDestroyCursor(MOVE_CURSOR);
192-
GLFW.glfwDestroyCursor(DEFAULT_CURSOR);
193-
GLFW.glfwDestroyCursor(NESW_RESIZE_CURSOR);
194-
GLFW.glfwDestroyCursor(NWSE_RESIZE_CURSOR);
195191
}
196192

197193
@Override

1.21.7/src/main/java/io/github/axolotlclient/modules/hud/HudEditScreen.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public class HudEditScreen extends Screen {
5454
private static final BooleanOption snapping = new BooleanOption("snapping", true);
5555
private static final OptionCategory hudEditScreenCategory = OptionCategory.create("hudEditScreen");
5656
private static final int GRAB_TOLERANCE = 5;
57-
private final long MOVE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_ALL_CURSOR);
58-
private final long DEFAULT_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
59-
private final long NWSE_RESIZE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_NWSE_CURSOR),
57+
private static final long MOVE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_ALL_CURSOR);
58+
private static final long DEFAULT_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
59+
private static final long NWSE_RESIZE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_NWSE_CURSOR),
6060
NESW_RESIZE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_NESW_CURSOR);
6161

6262
public static boolean isSnappingEnabled() {
@@ -157,10 +157,6 @@ public void removed() {
157157
setCursor(DEFAULT_CURSOR);
158158
mode = ModificationMode.NONE;
159159
super.removed();
160-
GLFW.glfwDestroyCursor(MOVE_CURSOR);
161-
GLFW.glfwDestroyCursor(DEFAULT_CURSOR);
162-
GLFW.glfwDestroyCursor(NESW_RESIZE_CURSOR);
163-
GLFW.glfwDestroyCursor(NWSE_RESIZE_CURSOR);
164160
}
165161

166162
@Override

1.21/src/main/java/io/github/axolotlclient/modules/hud/HudEditScreen.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public class HudEditScreen extends Screen {
5454
private static final BooleanOption snapping = new BooleanOption("snapping", true);
5555
private static final OptionCategory hudEditScreenCategory = OptionCategory.create("hudEditScreen");
5656
private static final int GRAB_TOLERANCE = 5;
57-
private final long MOVE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_ALL_CURSOR);
58-
private final long DEFAULT_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
59-
private final long NWSE_RESIZE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_NWSE_CURSOR),
57+
private static final long MOVE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_ALL_CURSOR);
58+
private static final long DEFAULT_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
59+
private static final long NWSE_RESIZE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_NWSE_CURSOR),
6060
NESW_RESIZE_CURSOR = GLFW.glfwCreateStandardCursor(GLFW.GLFW_RESIZE_NESW_CURSOR);
6161

6262
public static boolean isSnappingEnabled() {
@@ -157,10 +157,6 @@ public void removed() {
157157
setCursor(DEFAULT_CURSOR);
158158
mode = ModificationMode.NONE;
159159
super.removed();
160-
GLFW.glfwDestroyCursor(MOVE_CURSOR);
161-
GLFW.glfwDestroyCursor(DEFAULT_CURSOR);
162-
GLFW.glfwDestroyCursor(NESW_RESIZE_CURSOR);
163-
GLFW.glfwDestroyCursor(NWSE_RESIZE_CURSOR);
164160
}
165161

166162
@Override

1.8.9/src/main/java/io/github/axolotlclient/modules/hud/HudEditScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public void removed() {
286286
super.removed();
287287
setCursor(DEFAULT_CURSOR);
288288
mode = ModificationMode.NONE;
289-
WindowAccess.getInstance().destroyCursors(DEFAULT_CURSOR, NWSE_RESIZE_CURSOR, NESW_RESIZE_CURSOR, MOVE_CURSOR);
289+
WindowAccess.getInstance().destroyStandardCursor(DEFAULT_CURSOR, NWSE_RESIZE_CURSOR, NESW_RESIZE_CURSOR, MOVE_CURSOR);
290290
}
291291

292292
@Override

1.8.9/src/main/java/io/github/axolotlclient/util/WindowAccess.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public enum Cursor {
5353

5454
public abstract void setCursor(long cursor);
5555

56-
public abstract void destroyCursors(long... cursors);
56+
public abstract void destroyStandardCursor(long... cursors);
5757

5858
public abstract boolean rawMouseMotionAvailable();
5959

@@ -105,7 +105,7 @@ public void setCursor(long cursor) {
105105
}
106106

107107
@Override
108-
public void destroyCursors(long... cursors) {
108+
public void destroyStandardCursor(long... cursors) {
109109

110110
}
111111

@@ -138,7 +138,7 @@ public void setCursor(long cursor) {
138138
}
139139

140140
@Override
141-
public void destroyCursors(long... cursors) {
141+
public void destroyStandardCursor(long... cursors) {
142142
for (long c : cursors) {
143143
SDLMouse.SDL_DestroyCursor(c);
144144
}
@@ -173,10 +173,8 @@ public void setCursor(long cursor) {
173173
}
174174

175175
@Override
176-
public void destroyCursors(long... cursors) {
177-
for (long c : cursors) {
178-
GLFW.glfwDestroyCursor(c);
179-
}
176+
public void destroyStandardCursor(long... cursors) {
177+
// we do not need to destroy glfw standard cursors ourselves
180178
}
181179

182180
@Override

0 commit comments

Comments
 (0)