Don't draw text on worker threads (#2701)

Drawing text requires OpenGL context if new characters need to be
rendered.
This commit is contained in:
Väinö Mäkelä
2020-06-07 19:14:27 +03:00
committed by GitHub
parent 31b9faaf23
commit 05ae6fc81f

View File

@ -55,7 +55,9 @@ class MapEditorMenuPopup(mapEditorScreen: MapEditorScreen): Popup(mapEditorScree
try { try {
MapSaver.saveMap(mapEditorScreen.mapName, mapEditorScreen.tileMap) MapSaver.saveMap(mapEditorScreen.mapName, mapEditorScreen.tileMap)
close() close()
ResponsePopup("Map saved", mapEditorScreen) // todo - add this text to translations Gdx.app.postRunnable {
ResponsePopup("Map saved", mapEditorScreen) // todo - add this text to translations
}
} catch (ex: Exception) { } catch (ex: Exception) {
ex.printStackTrace() ex.printStackTrace()
Gdx.app.postRunnable { Gdx.app.postRunnable {
@ -97,16 +99,20 @@ class MapEditorMenuPopup(mapEditorScreen: MapEditorScreen): Popup(mapEditorScree
DropBox.uploadFile("/Maps/" + mapEditorScreen.mapName, gzippedMap) DropBox.uploadFile("/Maps/" + mapEditorScreen.mapName, gzippedMap)
remove() remove()
val uploadedSuccessfully = Popup(screen) Gdx.app.postRunnable {
uploadedSuccessfully.addGoodSizedLabel("Map uploaded successfully!").row() val uploadedSuccessfully = Popup(screen)
uploadedSuccessfully.addCloseButton() uploadedSuccessfully.addGoodSizedLabel("Map uploaded successfully!").row()
uploadedSuccessfully.open() uploadedSuccessfully.addCloseButton()
uploadedSuccessfully.open()
}
} catch (ex: Exception) { } catch (ex: Exception) {
remove() remove()
val couldNotUpload = Popup(screen) Gdx.app.postRunnable {
couldNotUpload.addGoodSizedLabel("Could not upload map!").row() val couldNotUpload = Popup(screen)
couldNotUpload.addCloseButton() couldNotUpload.addGoodSizedLabel("Could not upload map!").row()
couldNotUpload.open() couldNotUpload.addCloseButton()
couldNotUpload.open()
}
} }
} }
} }