From 3cc42f6d233aba508c932a7d1d5578799e9236fa Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 1 Dec 2019 14:23:57 +0100 Subject: Fix size computation of imported lists XFixes contains a CreateRegion request: This request contains a list of type RECTANGLE. This struct comes from xproto and is thus not contained in xfixes itself. Normal "Struct"s have their resolve() method called early, because they appear in the module itself. However, in the CreateRegion case, this struct is imported and thus does not get resolved. Instead, ListType's resolve() method calls self.member.resolve(module). Thus, only at this point is the struct resolved. Why is this important? Struct.resolve() is the same as ComplexType.resolve() and this function does self.calc_size() at the end. Thus, only after the struct was resolved is its size known. Before that, the size is just set to 0 (this happens in ComplexType.__init__). However, ListType.__init__ already computes its size member based on its member. At this point, this is still 0 so the list ends up believing its size to be zero. Fix this by recomputing self.size in ListType.resolve(). Signed-off-by: Uli Schlachter --- xcbgen/xtypes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py index 0fa420b..8a9d130 100644 --- a/xcbgen/xtypes.py +++ b/xcbgen/xtypes.py @@ -333,6 +333,9 @@ class ListType(Type): self.member.resolve(module) self.expr.resolve(module, self.parents) + # resolve() could have changed the size (ComplexType starts with size 0) + self.size = self.member.size if self.member.fixed_size() else None + self.required_start_align = self.member.required_start_align # Find my length field again. We need the actual Field object in the expr. -- cgit v1.2.3