<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [X11] Add XUniquePtr and XUniqueResource to automatically free X resources"
href="https://bugs.webkit.org/show_bug.cgi?id=144521#c9">Comment # 9</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [X11] Add XUniquePtr and XUniqueResource to automatically free X resources"
href="https://bugs.webkit.org/show_bug.cgi?id=144521">bug 144521</a>
from <span class="vcard"><a class="email" href="mailto:zan@falconsigh.net" title="Zan Dobersek <zan@falconsigh.net>"> <span class="fn">Zan Dobersek</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=252487&action=diff" name="attach_252487" title="Try to fix EFL build">attachment 252487</a> <a href="attachment.cgi?id=252487&action=edit" title="Try to fix EFL build">[details]</a></span>
Try to fix EFL build
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=252487&action=review">https://bugs.webkit.org/attachment.cgi?id=252487&action=review</a>
<span class="quote">> Source/WebCore/PlatformEfl.cmake:200
> + platform/graphics/x11/XUnique.cpp</span >
Consider splitting XUnique.h into XUniquePtr.h and XUniqueResource.h, and renaming XUnique.cpp to XUniqueResource.cpp.
<span class="quote">> Source/WebCore/platform/graphics/x11/XUnique.h:124
> + long unsigned release() { long unsigned resource = m_resource; m_resource = 0; return resource; }</span >
Use std::exchange() here. (It's C++14, but there's an implementation in StdLibExtras.h.)
<span class="quote">> Source/WebCore/platform/graphics/x11/XUnique.h:126
> + void reset(long unsigned resource = 0)</span >
Instead of `resource.reset()`, I'd prefer resource = nullptr;
If you consider it, it possible to implement by overloading the assignment operator:
XUniqueResource& operator=(std::nullptr_t) { ... }
<span class="quote">> Source/WebCore/platform/graphics/x11/XUnique.h:164
> +typedef XUniqueResource<XResource::Colormap> XUniqueColormap;
> +#if PLATFORM(GTK)
> +typedef XUniqueResource<XResource::Damage> XUniqueDamage;
> +#endif
> +typedef XUniqueResource<XResource::Pixmap> XUniquePixmap;
> +typedef XUniqueResource<XResource::Window> XUniqueWindow;
> +#if USE(GLX)
> +typedef XUniqueResource<XResource::GLXPbuffer> XUniqueGLXPbuffer;
> +typedef XUniqueResource<XResource::GLXPixmap> XUniqueGLXPixmap;
> +#endif
> +
> +// Give a name also to these XUniquePtr to avoid having to use the internal struct names (_XGC, __GLXcontextRec, ...).
> +typedef XUniquePtr<_XGC> XUniqueGC;
> +#if USE(GLX)
> +typedef XUniquePtr<__GLXcontextRec> XUniqueGLXContext;
> +#endif</span >
Use type aliases:
using XUniqueWhatever = XUniqueHandler<Whatever>;</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>