Skip to content

Commit 78285f3

Browse files
RaydanOMGrartdeell
authored andcommitted
Fixed last element stuff in linked list
1 parent 3a6cf26 commit 78285f3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

app_pojavlauncher/src/main/jni/egl_bridge.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ EXTERNAL_API void* pojavCreateCursor(GLFWimage* image, int xhot, int yhot) {
291291
image->width, image->height, xhot, yhot);
292292
jobject globalCursor = (*env)->NewGlobalRef(env, cursor);
293293
// not needed anymore
294+
(*env)->DeleteLocalRef(env, cursor);
294295
(*env)->DeleteLocalRef(env, buffer);
295296

296297
linkedlist_append(pojav_environ->cursors, globalCursor);
@@ -321,6 +322,10 @@ EXTERNAL_API void pojavDestroyCursor(jobject cursor) {
321322
} else {
322323
prev->next = current->next;
323324
}
325+
if (current == pojav_environ->cursors->last) {
326+
pojav_environ->cursors->last = prev;
327+
}
328+
324329
(*env)->DeleteGlobalRef(env, current->value);
325330
free(current);
326331
break;

0 commit comments

Comments
 (0)