mirror of
https://github.com/labwc/labwc.git
synced 2026-04-09 08:21:18 -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 <pixman.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
#include "common/scene-helpers.h"
|
||||
#include "config/rcxml.h"
|
||||
#include "labwc.h"
|
||||
#include "output.h"
|
||||
|
|
@ -17,7 +18,7 @@ ssd_extents_create(struct ssd *ssd)
|
|||
|
||||
int border_width = MAX(0, MAX(rc.resize_minimum_area, theme->border_width));
|
||||
|
||||
ssd->extents.tree = wlr_scene_tree_create(ssd->tree);
|
||||
ssd->extents.tree = lab_wlr_scene_tree_create(ssd->tree);
|
||||
struct wlr_scene_tree *parent = ssd->extents.tree;
|
||||
if (view->fullscreen || view->maximized == VIEW_AXIS_BOTH) {
|
||||
wlr_scene_node_set_enabled(&parent->node, false);
|
||||
|
|
@ -26,10 +27,10 @@ ssd_extents_create(struct ssd *ssd)
|
|||
-border_width, -(ssd->titlebar.height + border_width));
|
||||
|
||||
float invisible[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
ssd->extents.top = wlr_scene_rect_create(parent, 0, 0, invisible);
|
||||
ssd->extents.left = wlr_scene_rect_create(parent, 0, 0, invisible);
|
||||
ssd->extents.right = wlr_scene_rect_create(parent, 0, 0, invisible);
|
||||
ssd->extents.bottom = wlr_scene_rect_create(parent, 0, 0, invisible);
|
||||
ssd->extents.top = lab_wlr_scene_rect_create(parent, 0, 0, invisible);
|
||||
ssd->extents.left = lab_wlr_scene_rect_create(parent, 0, 0, invisible);
|
||||
ssd->extents.right = lab_wlr_scene_rect_create(parent, 0, 0, invisible);
|
||||
ssd->extents.bottom = lab_wlr_scene_rect_create(parent, 0, 0, invisible);
|
||||
|
||||
/* Initial manual update to keep X11 applications happy */
|
||||
ssd_extents_update(ssd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue