Increase default LWJGL Stack Size, do not crash with big clipboard

This commit is contained in:
fgnm
2022-01-04 22:51:36 +01:00
parent 177d85a6e7
commit 4e4766600b
2 changed files with 9 additions and 1 deletions
@@ -42,6 +42,8 @@ public class Main {
}
Thread.currentThread().setUncaughtExceptionHandler(new CustomExceptionHandler());
//Increase default lwjgl stack size
System.setProperty("org.lwjgl.system.stackSize", "256");
HyperLap2DFacade.getInstance();
@@ -49,6 +49,7 @@ import games.rednblack.editor.renderer.utils.HyperJson;
import games.rednblack.editor.system.ParticleContinuousSystem;
import games.rednblack.editor.system.PhysicsAdjustSystem;
import games.rednblack.editor.system.TalosContinuousSystem;
import games.rednblack.editor.utils.NativeDialogs;
import games.rednblack.editor.utils.runtime.SandboxComponentRetriever;
import games.rednblack.editor.view.ItemControlMediator;
import games.rednblack.editor.view.SceneControlMediator;
@@ -506,7 +507,12 @@ public class Sandbox {
Lwjgl3Application app = (Lwjgl3Application) Gdx.app;
Json json = HyperJson.getJson();
app.getClipboard().setContents(json.toJson(payload));
try {
app.getClipboard().setContents(json.toJson(payload));
} catch (OutOfMemoryError e) {
e.printStackTrace();
NativeDialogs.showError("You are trying to copy too many objects!");
}
}
public static Object retrieveFromClipboard() {