mirror of
https://github.com/hyprwm/hyprwayland-scanner.git
synced 2024-11-23 15:45:59 +01:00
client: properly release objects on destroy
This commit is contained in:
parent
1413398dca
commit
914f083741
1 changed files with 12 additions and 2 deletions
14
src/main.cpp
14
src/main.cpp
|
@ -871,6 +871,16 @@ void {}::onDestroyCalled() {{
|
||||||
IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, IFACE_NAME + "_interface", IFACE_CLASS_NAME_CAMEL, IFACE_VTABLE_NAME, IFACE_CLASS_NAME_CAMEL,
|
IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, IFACE_NAME + "_interface", IFACE_CLASS_NAME_CAMEL, IFACE_VTABLE_NAME, IFACE_CLASS_NAME_CAMEL,
|
||||||
IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL);
|
IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL);
|
||||||
} else {
|
} else {
|
||||||
|
std::string DTOR_FUNC = "";
|
||||||
|
|
||||||
|
for (auto& rq : iface.requests) {
|
||||||
|
if (!rq.destructor)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
DTOR_FUNC = camelize("send_" + rq.name) + "()";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
SOURCE += std::format(R"#(
|
SOURCE += std::format(R"#(
|
||||||
{}::{}(wl_resource* resource) {{
|
{}::{}(wl_resource* resource) {{
|
||||||
pResource = resource;
|
pResource = resource;
|
||||||
|
@ -883,10 +893,10 @@ void {}::onDestroyCalled() {{
|
||||||
|
|
||||||
{}::~{}() {{
|
{}::~{}() {{
|
||||||
if (!destroyed)
|
if (!destroyed)
|
||||||
wl_proxy_destroy(pResource);
|
{};
|
||||||
}}
|
}}
|
||||||
)#",
|
)#",
|
||||||
IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, IFACE_VTABLE_NAME, IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL);
|
IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, IFACE_VTABLE_NAME, IFACE_CLASS_NAME_CAMEL, IFACE_CLASS_NAME_CAMEL, DTOR_FUNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& rq : (clientCode ? iface.events : iface.requests)) {
|
for (auto& rq : (clientCode ? iface.events : iface.requests)) {
|
||||||
|
|
Loading…
Reference in a new issue