mirror of
https://github.com/labwc/labwc.git
synced 2026-05-08 12:06:34 -04:00
tree-wide: use die_if_null() for wlr_scene alloc failures
Some checks failed
labwc.github.io / notify (push) Has been cancelled
Some checks failed
labwc.github.io / notify (push) Has been cancelled
wlr_scene_*_create() functions all allocate memory via calloc() and return NULL if the allocation fails. Previously, the failures were handled in any of 3 different ways: - sending a wayland protocol error - exiting labwc with an error - segfault (no NULL check at all) Since labwc does not attempt to survive heap exhaustion in other allocation paths (such as `znew`), it seems more consistent to use the same die_if_null() check used in those paths to exit with an error. For the three most common create() functions (tree, rect, buffer), add small lab_wlr_ wrappers to common/scene-helpers.
This commit is contained in:
parent
c4effef0ec
commit
16c5373be5
27 changed files with 155 additions and 141 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include <assert.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
#include "common/lab-scene-rect.h"
|
||||
#include "common/scene-helpers.h"
|
||||
#include "labwc.h"
|
||||
#include "cycle.h"
|
||||
#include "output.h"
|
||||
|
|
@ -23,7 +24,7 @@ cycle_osd_scroll_init(struct cycle_osd_output *osd_output, struct wlr_box bar_ar
|
|||
scroll->top_row_idx = 0;
|
||||
scroll->bar_area = bar_area;
|
||||
scroll->delta_y = delta_y;
|
||||
scroll->bar_tree = wlr_scene_tree_create(osd_output->tree);
|
||||
scroll->bar_tree = lab_wlr_scene_tree_create(osd_output->tree);
|
||||
wlr_scene_node_set_position(&scroll->bar_tree->node,
|
||||
bar_area.x, bar_area.y);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue