Skip to content

[Bug]: wlr_buffer::lock() return value is not used, locked object might be different #647

@wineee

Description

@wineee

SUMMARY | 问题概要

The implementation of struct wlr_buffer *wlr_buffer_lock(struct wlr_buffer *buffer) { buffer->n_locks++; return buffer; } is currently just syntax sugar, and locking a buffer returns the same object at the moment. However, this is potentially dangerous because a future implementation might return a different buffer object after locking.

In addition, in waylib, many places simply call buffer->lock() without using the return value. This can cause bugs if the implementation changes.

LAUNCH-WAY | 启动方式

ddm

BACKEND | 启动后端

unknown

STEPS TO REPRODUCE | 复现步骤

1

OBSERVED RESULT | 观察到的结果

No response

EXPECTED RESULT | 期望的结果

No response

ADDITIONAL INFORMATION | 额外补充

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions