fix crash yayy

This commit is contained in:
ConfiG 2024-01-15 00:55:18 +03:00
parent 7631b045e1
commit ab436bd7c3
No known key found for this signature in database
GPG key ID: 44DA1983F524C11B
4 changed files with 4 additions and 8 deletions

View file

@ -3,7 +3,7 @@
using namespace geode::prelude;
Hook::Hook(std::shared_ptr<Impl>&& impl) : m_impl(std::move(impl)) {}
Hook::Hook(std::shared_ptr<Impl>&& impl) : m_impl(std::move(impl)) { m_impl->m_self = this; }
Hook::~Hook() = default;
Hook* Hook::create(

View file

@ -39,9 +39,7 @@ Hook* Hook::Impl::create(
auto impl = std::make_shared<Impl>(
address, detour, displayName, handlerMetadata, hookMetadata
);
auto hook = new Hook(std::move(impl));
impl->m_self = hook;
return hook;
return new Hook(std::move(impl));
}
Result<> Hook::Impl::enable() {

View file

@ -3,7 +3,7 @@
using namespace geode::prelude;
Patch::Patch(std::shared_ptr<Impl>&& impl) : m_impl(std::move(impl)) {}
Patch::Patch(std::shared_ptr<Impl>&& impl) : m_impl(std::move(impl)) { m_impl->m_self = this; }
Patch::~Patch() = default;
Patch* Patch::create(void* address, const ByteVector& patch) {

View file

@ -35,9 +35,7 @@ Patch* Patch::Impl::create(void* address, const geode::ByteVector& patch) {
auto impl = std::make_shared<Impl>(
address, readMemory(address, patch.size()), patch
);
auto p = new Patch(std::move(impl));
impl->m_self = p;
return p;
return new Patch(std::move(impl));
}
Result<> Patch::Impl::enable() {