SFML / SFML

Simple and Fast Multimedia Library

Home Page:https://www.sfml-dev.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor raw pointer + ref count to a `std::shared_ptr` in Unix/Display.cpp

ChrisThrasher opened this issue · comments

It seems less than ideal to have a raw pointer and an accompanying reference count both as global variables. I think we can more expressively implement this as a shared pointer with a custom deleter.

I now see both sharedDisplay and sharedXIM need this treatment. They also share one mutex which isn't entirely accurate. Luckily the atomic ref count in the shared point will let us remove that mutex and the locks that use it.