Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot DisplayServer on MacOS crashes when leaving Fullscreen #85022

Closed
blockimperiumdao opened this issue Nov 17, 2023 · 3 comments · Fixed by #84683
Closed

Godot DisplayServer on MacOS crashes when leaving Fullscreen #85022

blockimperiumdao opened this issue Nov 17, 2023 · 3 comments · Fixed by #84683

Comments

@blockimperiumdao
Copy link

blockimperiumdao commented Nov 17, 2023

Godot version

v4.1.3.stable.official [f06b6836a]

System information

Godot v4.1.3.stable - macOS 14.1.1 - Vulkan (Forward+) - integrated Apple M2 Pro - Apple M2 Pro (10 Threads)

Issue description

Moving between the various window modes will throw exceptions that cause the application to crash when switching back from WINDOW_MODE_FULLSCREEN with the borderless flag set to true, and any other display mode. In general, returning from a FULLSCREEN mode to a windowed one on MacOS will result in a crash.

Steps to reproduce

extends Control


@onready var option_button:OptionButton = $HBoxContainer/OptionButton as OptionButton
@onready var label:Label = $HBoxContainer/Label as Label

const WINDOW_MODE_ARRAY : Array[String] = [
	"Fullscreen",
	"Windowed",
	"Borderless Window",
	"Borderless Fullscreen"
]

func _ready():
	option_button.item_selected.connect(on_window_mode_selected)
	add_window_mode_items()
	
func add_window_mode_items() -> void:
	for window_mode in WINDOW_MODE_ARRAY:
		option_button.add_item(window_mode)
	
func on_window_mode_selected(index: int) ->void:
	match index:
		0: #fullscreen
			DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
			DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, false)
		1: #windowed
			DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
			DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, false)
		2: #borderless windowed
			DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
			DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true)
		3: #borderless fullscreen	
			DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
			DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true)

Attaching this control to a scene will illustrate the issue. You can go easily from the windowed modes, but if you go to WINDOW_MODE_FULLSCREEN (option 3), and you try to go to any other mode - you will get the error listed below.

Minimal reproduction project

E 0:00:17:0148   window_mode_button.gd:-1 @ on_window_mode_selected(): NSException: NSWindowStyleMaskFullScreen cleared on a window outside of a full screen transition. Called from (
	0   AppKit                              0x000000018fdc4b90 __25-[NSWindow setStyleMask:]_block_invoke + 140
	1   AppKit                              0x000000018fdc4ab0 NSPerformVisuallyAtomicChange + 108
	2   AppKit                              0x000000018fdc4990 -[NSWindow setStyleMask:] + 176
	3   Godot                               0x00000001046967a0 _ZN9DirAccess15_create_builtinI14DirAccessMacOSEE3RefIS_Ev + 91612
	4   Godot                               0x0000000107380f28 _ZN15RasterizerDummy15_create_currentEv + 95776
	5   Godot                               0x0000000107380b4c _ZN15RasterizerDummy15_create_currentEv + 94788
	6   Godot                               0x000000010496e924 _ZN18VariantInitializerI6VectorI5ColorEE4initEP7Variant + 61560
	7   Godot                               0x000000010484b458 _ZN7ClassDB7creatorI14ENetConnectionEEP6Objectv + 111820
	8   Godot                               0x00000001083e4220 _ZNK6Object15get_instance_idEv + 1512
	9   Godot                               0x000000010807cd68 _ZNK4JSON8get_dataEv + 1189000
	10  Godot                               0x00000001083e8108 _ZNK6Object15get_instance_idEv + 17616
	11  Godot                               0x0000000107352d60 _ZN29TileSetScenesCollectionSource17get_scene_tile_idEi + 1853744
	12  Godot                               0x000000010670f548 _ZN8ItemList16get_v_scroll_barEv + 346768
	13  Godot                               0x00000001083e8108 _ZNK6Object15get_instance_idEv + 17616
	14  Godot                               0x0000000107352d60 _ZN29TileSetScenesCollectionSource17get_scene_tile_idEi + 1853744
	15  Godot                               0x000000010671d008 _ZN8ItemList16get_v_scroll_barEv + 402768
	16  Godot                               0x000000010673c700 _ZN8ItemList16get_v_scroll_barEv + 531528
	17  Godot                               0x00000001083e8108 _ZNK6Object15get_instance_idEv + 17616
	18  Godot                               0x000000010655aecc _ZNK9SceneTree8get_rootEv + 476660
	19  Godot                               0x00000001065589a4 _ZNK9SceneTree8get_rootEv + 467148
	20  Godot                               0x000000010651afd0 _ZNK9SceneTree8get_rootEv + 214776
	21  Godot                               0x000000010651b84c _ZNK9SceneTree8get_rootEv + 216948
	22  Godot                               0x00000001065589fc _ZNK9SceneTree8get_rootEv + 467236
	23  Godot                               0x0000000106576004 _ZNK9SceneTree8get_rootEv + 587564
	24  Godot                               0x0000000104685428 _ZN9DirAccess15_create_builtinI14DirAccessMacOSEE3RefIS_Ev + 21092
	25  Godot                               0x000000010800cd64 _ZNK4JSON8get_dataEv + 730244
	26  Godot                               0x000000010800a054 _ZNK4JSON8get_dataEv + 718708
	27  Godot                               0x0000000104699638 _ZN9DirAccess15_create_builtinI14DirAccessMacOSEE3RefIS_Ev + 103540
	28  Godot                               0x000000010467ef64 Godot + 4042596
	29  Godot                               0x00000001046a917c _ZN20RendererCompositorRD15_create_currentEv + 46508
	30  dyld                                0x000000018c1510e0 start + 2360
)
  <C++ Source>   platform/macos/os_macos.mm:728 @ run()
  <Stack Trace>  window_mode_button.gd:-1 @ on_window_mode_selected()
@AThousandShips
Copy link
Member

Your error message is not a minimum reproduction project:

  • A small Godot project which reproduces the issue, with no unnecessary files included. Be sure to not include the .godot folder in the archive (but keep project.godot).
  • Drag and drop a ZIP archive to upload it. Do not select another field until the project is done uploading.
  • Note for C# users: If your issue is not Mono-specific, please upload a minimal reproduction project written in GDScript or VisualScript. This will make it easier for contributors to reproduce the issue locally as not everyone has a Mono setup available.

You need to surround multi line code with three backticks on their own line, I've fixed this for you but please remember in the future

@bruvzg
Copy link
Member

bruvzg commented Nov 17, 2023

Should be already fixed by #84683

It's not crashing when exiting fullscreen, but when you are trying to set borderless flag while still in fullscreen (which is a meaningless combination).

@blockimperiumdao
Copy link
Author

Can confirm that we aren't seeing this with v4.2.rc1.official [ad72de5]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants