mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
Merge branch 'wip/otte/for-main' into 'main'
roaring: Remove extra careful code Closes #4252 and #4517 See merge request GNOME/gtk!4669
This commit is contained in:
commit
940248598e
@ -288,6 +288,12 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self,
|
||||
*natural = largest_nat;
|
||||
}
|
||||
|
||||
/* if widgets haven't reached their min opposite size at this
|
||||
* huge value, things went massively wrong and we need to bail to not
|
||||
* cause an infinite loop.
|
||||
*/
|
||||
#define MAX_ALLOWED_SIZE (1 << 20)
|
||||
|
||||
static int
|
||||
distribute_remaining_size (GtkRequestedSize *sizes,
|
||||
gsize n_sizes,
|
||||
@ -321,7 +327,40 @@ distribute_remaining_size (GtkRequestedSize *sizes,
|
||||
{
|
||||
int test;
|
||||
|
||||
if (max == G_MAXINT)
|
||||
if (min > MAX_ALLOWED_SIZE)
|
||||
{
|
||||
/* sanity check! */
|
||||
for (i = 0; i < n_sizes; i++)
|
||||
{
|
||||
int check_min, check_nat;
|
||||
gtk_widget_measure (sizes[i].data,
|
||||
orientation,
|
||||
MAX_ALLOWED_SIZE,
|
||||
&sizes[i].minimum_size, &sizes[i].natural_size,
|
||||
NULL, NULL);
|
||||
gtk_widget_measure (sizes[i].data,
|
||||
orientation,
|
||||
-1,
|
||||
&check_min, &check_nat,
|
||||
NULL, NULL);
|
||||
if (check_min < sizes[i].minimum_size)
|
||||
{
|
||||
g_critical ("%s %p reports a minimum %s of %u, but minimum %s for %s of %u is %u. Expect overlapping widgets.",
|
||||
G_OBJECT_TYPE_NAME (sizes[i].data), sizes[i].data,
|
||||
orientation == GTK_ORIENTATION_HORIZONTAL ? "width" : "height",
|
||||
check_min,
|
||||
orientation == GTK_ORIENTATION_HORIZONTAL ? "width" : "height",
|
||||
orientation == GTK_ORIENTATION_HORIZONTAL ? "height" : "width",
|
||||
MAX_ALLOWED_SIZE, sizes[i].minimum_size);
|
||||
sizes[i].minimum_size = check_min;
|
||||
sizes[i].natural_size = check_nat;
|
||||
}
|
||||
total_size += sizes[i].minimum_size;
|
||||
}
|
||||
return MAX (0, available - total_size);
|
||||
}
|
||||
|
||||
if (max == MAX_ALLOWED_SIZE)
|
||||
test = min * 2;
|
||||
else
|
||||
test = (min + max) / 2;
|
||||
@ -465,7 +504,7 @@ gtk_box_layout_compute_opposite_size_for_size (GtkBoxLayout *self,
|
||||
self->orientation,
|
||||
available,
|
||||
min_size,
|
||||
G_MAXINT);
|
||||
MAX_ALLOWED_SIZE);
|
||||
|
||||
/* Bring children up to size first */
|
||||
available = gtk_distribute_natural_allocation (available, nvis_children, sizes);
|
||||
|
@ -2979,7 +2979,6 @@ int array_container_shrink_to_fit(array_container_t *src) {
|
||||
uint16_t *oldarray = src->array;
|
||||
src->array =
|
||||
(uint16_t *)realloc(oldarray, src->capacity * sizeof(uint16_t));
|
||||
if (src->array == NULL) free(oldarray); // should never happen?
|
||||
}
|
||||
return savings;
|
||||
}
|
||||
@ -3016,7 +3015,6 @@ void array_container_grow(array_container_t *container, int32_t min,
|
||||
if (preserve) {
|
||||
container->array =
|
||||
(uint16_t *)realloc(array, new_capacity * sizeof(uint16_t));
|
||||
if (container->array == NULL) free(array);
|
||||
} else {
|
||||
// Jon Strabala reports that some tools complain otherwise
|
||||
if (array != NULL) {
|
||||
@ -6691,7 +6689,6 @@ int run_container_shrink_to_fit(run_container_t *src) {
|
||||
src->capacity = src->n_runs;
|
||||
rle16_t *oldruns = src->runs;
|
||||
src->runs = (rle16_t *)realloc(oldruns, src->capacity * sizeof(rle16_t));
|
||||
if (src->runs == NULL) free(oldruns); // should never happen?
|
||||
return savings;
|
||||
}
|
||||
/* Create a new run container. Return NULL in case of failure. */
|
||||
@ -6731,7 +6728,6 @@ void run_container_grow(run_container_t *run, int32_t min, bool copy) {
|
||||
rle16_t *oldruns = run->runs;
|
||||
run->runs =
|
||||
(rle16_t *)realloc(oldruns, run->capacity * sizeof(rle16_t));
|
||||
if (run->runs == NULL) free(oldruns);
|
||||
} else {
|
||||
// Jon Strabala reports that some tools complain otherwise
|
||||
if (run->runs != NULL) {
|
||||
|
@ -483,7 +483,7 @@ gtk_ff_media_file_open (GtkMediaFile *file)
|
||||
{
|
||||
GtkFfMediaFile *video = GTK_FF_MEDIA_FILE (file);
|
||||
AVStream *stream;
|
||||
AVCodec *codec;
|
||||
const AVCodec *codec;
|
||||
int errnum;
|
||||
|
||||
video->format_ctx = avformat_alloc_context ();
|
||||
|
Loading…
Reference in New Issue
Block a user