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; crtc_mode_info->refresh_rate = spec->refresh_rate;
return g_object_new (META_TYPE_CRTC_MODE, return g_object_new (META_TYPE_CRTC_MODE,
"id", mode_id, "id", (uint64_t) mode_id,
"info", crtc_mode_info, "info", crtc_mode_info,
NULL); NULL);
} }
@ -205,7 +205,7 @@ append_monitor (MetaMonitorManager *manager,
*modes = g_list_concat (*modes, new_modes); *modes = g_list_concat (*modes, new_modes);
crtc = g_object_new (META_TYPE_CRTC_DUMMY, crtc = g_object_new (META_TYPE_CRTC_DUMMY,
"id", g_list_length (*crtcs) + 1, "id", (uint64_t) g_list_length (*crtcs) + 1,
"gpu", gpu, "gpu", gpu,
NULL); NULL);
*crtcs = g_list_append (*crtcs, crtc); *crtcs = g_list_append (*crtcs, crtc);
@ -237,7 +237,7 @@ append_monitor (MetaMonitorManager *manager,
output_info->n_possible_crtcs = 1; output_info->n_possible_crtcs = 1;
output = g_object_new (META_TYPE_OUTPUT_DUMMY, output = g_object_new (META_TYPE_OUTPUT_DUMMY,
"id", number, "id", (uint64_t) number,
"gpu", gpu, "gpu", gpu,
"info", output_info, "info", output_info,
NULL); NULL);
@ -291,7 +291,7 @@ append_tiled_monitor (MetaMonitorManager *manager,
MetaCrtc *crtc; MetaCrtc *crtc;
crtc = g_object_new (META_TYPE_CRTC_DUMMY, 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, "gpu", gpu,
NULL); NULL);
new_crtcs = g_list_append (new_crtcs, crtc); 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_info->n_possible_crtcs = n_tiles;
output = g_object_new (META_TYPE_OUTPUT_DUMMY, output = g_object_new (META_TYPE_OUTPUT_DUMMY,
"id", number, "id", (uint64_t) number,
"gpu", gpu, "gpu", gpu,
"info", output_info, "info", output_info,
NULL); 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, primary_plane = meta_kms_device_get_primary_plane_for (kms_device,
kms_crtc); kms_crtc);
crtc_kms = g_object_new (META_TYPE_CRTC_KMS, 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, "gpu", gpu,
NULL); NULL);

View File

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

View File

@ -154,7 +154,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
crtc_mode_name = get_xmode_name (xmode); crtc_mode_name = get_xmode_name (xmode);
mode = g_object_new (META_TYPE_CRTC_MODE, mode = g_object_new (META_TYPE_CRTC_MODE,
"id", xmode->id, "id", (uint64_t) xmode->id,
"name", crtc_mode_name, "name", crtc_mode_name,
"info", crtc_mode_info, "info", crtc_mode_info,
NULL); 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_info_init_backlight_limits_xrandr (output_info, xdisplay, output_id);
output = g_object_new (META_TYPE_OUTPUT_XRANDR, output = g_object_new (META_TYPE_OUTPUT_XRANDR,
"id", output_id, "id", (uint64_t) output_id,
"gpu", gpu_xrandr, "gpu", gpu_xrandr,
"info", output_info, "info", output_info,
NULL); NULL);

View File

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

View File

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