Fix segfaults on 32-bit systems.

The new "id" properties for the MetaCrtc* and MetaOuput* objects are 64-bit
values, so take care to pass 64-bit values when calling g_object_new.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1343.
This commit is contained in:
Martin Whitaker 2020-07-23 16:01:16 +01:00 committed by Jonas Ådahl
parent ac6990ef51
commit 7b79fcee45
7 changed files with 15 additions and 15 deletions

View File

@ -96,7 +96,7 @@ create_mode (CrtcModeSpec *spec,
crtc_mode_info->refresh_rate = spec->refresh_rate;
return g_object_new (META_TYPE_CRTC_MODE,
"id", mode_id,
"id", (uint64_t) mode_id,
"info", crtc_mode_info,
NULL);
}
@ -205,7 +205,7 @@ append_monitor (MetaMonitorManager *manager,
*modes = g_list_concat (*modes, new_modes);
crtc = g_object_new (META_TYPE_CRTC_DUMMY,
"id", g_list_length (*crtcs) + 1,
"id", (uint64_t) g_list_length (*crtcs) + 1,
"gpu", gpu,
NULL);
*crtcs = g_list_append (*crtcs, crtc);
@ -237,7 +237,7 @@ append_monitor (MetaMonitorManager *manager,
output_info->n_possible_crtcs = 1;
output = g_object_new (META_TYPE_OUTPUT_DUMMY,
"id", number,
"id", (uint64_t) number,
"gpu", gpu,
"info", output_info,
NULL);
@ -291,7 +291,7 @@ append_tiled_monitor (MetaMonitorManager *manager,
MetaCrtc *crtc;
crtc = g_object_new (META_TYPE_CRTC_DUMMY,
"id", g_list_length (*crtcs) + i + 1,
"id", (uint64_t) g_list_length (*crtcs) + i + 1,
"gpu", gpu,
NULL);
new_crtcs = g_list_append (new_crtcs, crtc);
@ -358,7 +358,7 @@ append_tiled_monitor (MetaMonitorManager *manager,
output_info->n_possible_crtcs = n_tiles;
output = g_object_new (META_TYPE_OUTPUT_DUMMY,
"id", number,
"id", (uint64_t) number,
"gpu", gpu,
"info", output_info,
NULL);

View File

@ -291,7 +291,7 @@ meta_crtc_kms_new (MetaGpuKms *gpu_kms,
primary_plane = meta_kms_device_get_primary_plane_for (kms_device,
kms_crtc);
crtc_kms = g_object_new (META_TYPE_CRTC_KMS,
"id", meta_kms_crtc_get_id (kms_crtc),
"id", (uint64_t) meta_kms_crtc_get_id (kms_crtc),
"gpu", gpu,
NULL);

View File

@ -244,7 +244,7 @@ meta_crtc_xrandr_new (MetaGpuXrandr *gpu_xrandr,
all_transforms =
meta_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
crtc_xrandr = g_object_new (META_TYPE_CRTC_XRANDR,
"id", crtc_id,
"id", (uint64_t) crtc_id,
"gpu", gpu,
"all-transforms", all_transforms,
NULL);

View File

@ -154,7 +154,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
crtc_mode_name = get_xmode_name (xmode);
mode = g_object_new (META_TYPE_CRTC_MODE,
"id", xmode->id,
"id", (uint64_t) xmode->id,
"name", crtc_mode_name,
"info", crtc_mode_info,
NULL);

View File

@ -871,7 +871,7 @@ meta_output_xrandr_new (MetaGpuXrandr *gpu_xrandr,
output_info_init_backlight_limits_xrandr (output_info, xdisplay, output_id);
output = g_object_new (META_TYPE_OUTPUT_XRANDR,
"id", output_id,
"id", (uint64_t) output_id,
"gpu", gpu_xrandr,
"info", output_info,
NULL);

View File

@ -137,14 +137,14 @@ meta_test_headless_monitor_connect (void)
crtc_mode_info->refresh_rate = 60.0;
crtc_mode = g_object_new (META_TYPE_CRTC_MODE,
"id", 1,
"id", (uint64_t) 1,
"info", crtc_mode_info,
NULL);
test_setup->modes = g_list_append (NULL, crtc_mode);
gpu = META_GPU (meta_backend_get_gpus (meta_get_backend ())->data);
crtc = g_object_new (META_TYPE_CRTC_TEST,
"id", 1,
"id", (uint64_t) 1,
"gpu", gpu,
NULL);
test_setup->crtcs = g_list_append (NULL, crtc);
@ -169,7 +169,7 @@ meta_test_headless_monitor_connect (void)
output_info->connector_type = META_CONNECTOR_TYPE_DisplayPort;
output = g_object_new (META_TYPE_OUTPUT_TEST,
"id", 1,
"id", (uint64_t) 1,
"gpu", gpu,
"info", output_info,
NULL);

View File

@ -556,7 +556,7 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
crtc_mode_info->flags = setup->modes[i].flags;
mode = g_object_new (META_TYPE_CRTC_MODE,
"id", i,
"id", (uint64_t) i,
"info", crtc_mode_info,
NULL);
@ -569,7 +569,7 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
MetaCrtc *crtc;
crtc = g_object_new (META_TYPE_CRTC_TEST,
"id", i + 1,
"id", (uint64_t) i + 1,
"gpu", test_get_gpu (),
NULL);
@ -676,7 +676,7 @@ create_monitor_test_setup (MonitorTestCaseSetup *setup,
setup->outputs[i].panel_orientation_transform;
output = g_object_new (META_TYPE_OUTPUT_TEST,
"id", i,
"id", (uint64_t) i,
"gpu", test_get_gpu (),
"info", output_info,
NULL);