Skip to content

Add abstract iOS launcher#2829

Merged
riccardobl merged 3 commits into
jMonkeyEngine:masterfrom
riccardobl:ioslauncher
May 28, 2026
Merged

Add abstract iOS launcher#2829
riccardobl merged 3 commits into
jMonkeyEngine:masterfrom
riccardobl:ioslauncher

Conversation

@riccardobl
Copy link
Copy Markdown
Member

mimics the AndroidHarnessFragment to make iOS bootstrap easier

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new abstract base class IosApplicationLauncher to centralize and simplify iOS application lifecycle management, and refactors IosTestChooserLauncher to extend it. The review feedback highlights a potential issue in IosApplicationLauncher where app.getContext() could return null during startup or shutdown, leading to an unexpected IllegalStateException in both the update() and resize() methods. Adding null checks for the context in these methods is recommended to prevent crashes.

Comment thread jme3-ios/src/main/java/com/jme3/app/IosApplicationLauncher.java
Comment thread jme3-ios/src/main/java/com/jme3/app/IosApplicationLauncher.java
@riccardobl
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new base class IosApplicationLauncher in the jme3-ios module to standardize iOS application launching in jMonkeyEngine, and refactors IosTestChooserLauncher to extend this new base class. Feedback on the changes suggests declaring the app field as volatile to ensure thread safety across the launcher and render threads. Additionally, it is recommended to rename the resize method to reshape to preserve backward compatibility, and to avoid throwing IllegalStateException in both update and reshape when the context is not an IGLESContext to prevent application crashes in non-standard or test environments.

Comment on lines +81 to +90
public void resize(int width, int height) {
if (app == null) return;
JmeContext context = app.getContext();
if (context == null) return;
if (context instanceof IGLESContext) {
((IGLESContext) context).resizeFramebuffer(width, height);
} else {
throw new IllegalStateException("Application context is not an IGLESContext");
}
}

This comment was marked as low quality.

*/
public abstract class IosApplicationLauncher {

protected Application app;

This comment was marked as low quality.

Comment on lines +70 to +79
public void update() {
if (app == null) return;
JmeContext context = app.getContext();
if (context == null) return;
if (context instanceof IGLESContext) {
((IGLESContext) context).runFrame();
} else {
throw new IllegalStateException("Application context is not an IGLESContext");
}
}

This comment was marked as low quality.

@riccardobl riccardobl merged commit 3433603 into jMonkeyEngine:master May 28, 2026
10 checks passed
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.

1 participant