flacjacket / pywlroots

Python binding to the wlroots library using cffi
University of Illinois/NCSA Open Source License
53 stars 14 forks source link

XdgTopLevel: Incorrect check of the pointer, a parent is always returned #183

Closed heuer closed 6 months ago

heuer commented 7 months ago

XdgTopLevel.parent() checks if the _ptr.parent is None which is never the case and returns a new XdgTopLevel instance with a pointer to NULL:

    def parent(self) -> XdgTopLevel | None:
        """The parent of this toplevel"""
        parent_ptr = self._ptr.parent
        if parent_ptr is None:
            return None
        return XdgTopLevel(parent_ptr)

Solution: Check against ffi.NULL and return None