Move constructors are dumber than I thought, don't use them
diff --git a/include/in_process_server.h b/include/in_process_server.h
index e3319c5..c0847a5 100644
--- a/include/in_process_server.h
+++ b/include/in_process_server.h
@@ -251,18 +251,6 @@
auto bind_if_supported(wl_interface const& interface, uint32_t min_version) const -> void*;
- template<typename GLOBAL>
- auto bind_if_supported(wl_interface const& interface, void(* destroy)(GLOBAL*)) const -> WlProxy<GLOBAL>
- {
- return WlProxy<GLOBAL>(static_cast<GLOBAL*>(bind_if_supported(interface, 1)), destroy);
- }
-
- template<typename GLOBAL>
- auto bind_if_supported(wl_interface const& interface, void(* destroy)(GLOBAL*), uint32_t min_version) const -> WlProxy<GLOBAL>
- {
- return WlProxy<GLOBAL>{static_cast<GLOBAL*>(bind_if_supported(interface, min_version)), destroy};
- }
-
void roundtrip();
private:
diff --git a/include/wl_proxy.h b/include/wl_proxy.h
index b5892f2..3bf705e 100644
--- a/include/wl_proxy.h
+++ b/include/wl_proxy.h
@@ -47,7 +47,7 @@
{
}
- WlProxy(Client const& /*client*/)
+ WlProxy(Client const& /*client*/, uint32_t /*min_version*/)
: WlProxy()
{
std::string const current_function = BOOST_CURRENT_FUNCTION;
@@ -56,6 +56,11 @@
"Add " + current_function + " specialization to wl_proxy.cpp"));
}
+ WlProxy(Client const& client)
+ : WlProxy(client, 1)
+ {
+ }
+
WlProxy(T* /*proxy*/)
: WlProxy()
{
@@ -65,8 +70,6 @@
"Add " + current_function + " specialization to wl_proxy.cpp"));
}
- WlProxy(WlProxy&&) = default;
-
~WlProxy()
{
if (destroy && proxy)
@@ -74,6 +77,7 @@
}
WlProxy(WlProxy const&) = delete;
+ WlProxy(WlProxy&&) = delete;
auto operator=(WlProxy const&) -> bool = delete;
operator bool() const
diff --git a/src/wl_proxy.cpp b/src/wl_proxy.cpp
index 49db4a2..c1132d5 100644
--- a/src/wl_proxy.cpp
+++ b/src/wl_proxy.cpp
@@ -13,8 +13,9 @@
#define GLOBAL_DEFAULT_DESTROY_PROXY_CONSTRUCTOR(name) \
template<> \
- WlProxy<name>::WlProxy(Client const& client) \
- : WlProxy(client.bind_if_supported(name##_interface, name ##_destroy)) \
+ WlProxy<name>::WlProxy(Client const& client, uint32_t min_version) \
+ : proxy{static_cast<name*>(client.bind_if_supported(name##_interface, min_version))}, \
+ destroy{name ##_destroy} \
{ \
}
diff --git a/tests/wl_output.cpp b/tests/wl_output.cpp
index 0d99847..10d6330 100644
--- a/tests/wl_output.cpp
+++ b/tests/wl_output.cpp
@@ -46,10 +46,9 @@
{
// Acquire *any* wl_output; we don't care which
- auto output = client.bind_if_supported<wl_output>(
- wl_output_interface,
- wl_output_release,
- WL_OUTPUT_RELEASE_SINCE_VERSION);
+ WlProxy<wl_output> const output{
+ static_cast<wl_output*>(client.bind_if_supported(wl_output_interface, WL_OUTPUT_RELEASE_SINCE_VERSION)),
+ wl_output_release};
client.roundtrip();
}
// output is now released