PlatformXcb.cpp: Use custom deleter for xcb types
ClosedPublic

Authored by fabiank on Aug 26 2019, 7:35 PM.

Details

Summary

std::unique_ptr uses std::default_delete, which calls delete on the
pointer managed by the unique_ptr. However, the xcb types were not
allocated with new, but with free. Hence, tools like asan will report a
malloc/delete missmatch. This is generally not an issue in practice, but
can be annoying when debugging.

To remedy this, we use a custom deleter which simply uses free instead
of delete.

Test Plan

Compile application with ASAN enabled. Note that after applying the patch, it does not
abort any longer due to the malloc/delete missmatch. Take a screenshot to verify that the program
is still working fine.

Diff Detail

Repository
R166 Spectacle
Branch
fixwarnings
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15674
Build 15692: arc lint + arc unit
fabiank created this revision.Aug 26 2019, 7:35 PM
Restricted Application added a project: Spectacle. · View Herald TranscriptAug 26 2019, 7:35 PM
Restricted Application added a subscriber: Spectacle. · View Herald Transcript
fabiank requested review of this revision.Aug 26 2019, 7:35 PM
davidre accepted this revision.Aug 28 2019, 10:13 AM
davidre added a subscriber: davidre.

Thanks

This revision is now accepted and ready to land.Aug 28 2019, 10:13 AM
This revision was automatically updated to reflect the committed changes.