1907 +::Display *x_display = nullptr;
1908 +
1909 +mgx::Platform::Platform()
IIRC, we guard against opening a platform twice, but we should throw if platform is created twice if this really has to be a singleton. (in the current case, it would leak x_display)
I guess also, x_display should be an RAII type in case either of these throw:
1918 + drm->setup(udev);
1919 + gbm.setup(*drm);
1651 +extern ::Display *x_display;
1400 +extern ::Display *x_display;
These two classes should take this dependency explicitly (as a shared_ptr perhaps), as this guards against ~Platform() being destroyed and destroying the resources that the two classes need.
Another round:
1977 + auto dpy = XOpenDisplay(NULL);
nullptr?
1907 +::Display *x_display = nullptr; :Platform( )
1908 +
1909 +mgx::Platform:
IIRC, we guard against opening a platform twice, but we should throw if platform is created twice if this really has to be a singleton. (in the current case, it would leak x_display)
I guess also, x_display should be an RAII type in case either of these throw:
1918 + drm->setup(udev);
1919 + gbm.setup(*drm);
1651 +extern ::Display *x_display;
1400 +extern ::Display *x_display;
These two classes should take this dependency explicitly (as a shared_ptr perhaps), as this guards against ~Platform() being destroyed and destroying the resources that the two classes need.