From 58a631f927a5df5b1273a0df12bf496f12fdbede Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Wed, 7 Feb 2024 21:27:36 +0100 Subject: [PATCH] fix more tags crash --- about.md | 2 ++ changelog.md | 1 + src/hooks/play_layer.cpp | 18 +++++++++++++++--- src/hooks/play_layer.hpp | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/about.md b/about.md index 9e60d81a..a9fa8ebd 100644 --- a/about.md +++ b/about.md @@ -6,6 +6,8 @@ Globed is an open-source, highly customizable multiplayer mod for Geometry Dash, In the main menu, an extra button is added to the bottom row. This button opens the Globed Menu, where you can join a server and start playing online with other people. +If you have any issues, suggestions or just want to see the development of the mod, you can join the [discord server](https://discord.gg/d56q5Dkdm3)! + ## Credit **mat, alk, and the rest of the Geode team** - thank you for creating Geode and for helping me with the issues I had using it. None of this would've been possible without your awesome efforts, and I really appreciate the work you've put in <3 diff --git a/changelog.md b/changelog.md index 102c42e1..cbf5a5d6 100644 --- a/changelog.md +++ b/changelog.md @@ -3,3 +3,4 @@ * Use github actions for releases (hopefully no more crashes on old CPUs) * Add a volume slider for voice chat * Fixed a crash in the editor +* Fixed an incompatibility with "More Level Tags", should no longer crash when opening a level diff --git a/src/hooks/play_layer.cpp b/src/hooks/play_layer.cpp index 8176cdb9..33642825 100644 --- a/src/hooks/play_layer.cpp +++ b/src/hooks/play_layer.cpp @@ -119,9 +119,12 @@ bool GlobedPlayLayer::init(GJGameLevel* level, bool p1, bool p2) { m_fields->playerStore = std::make_shared(); // update - Loader::get()->queueInMainThread([this] { - this->rescheduleSelectors(); - CCScheduler::get()->scheduleSelector(schedule_selector(GlobedPlayLayer::selUpdate), this->getParent(), 0.0f, false); + Loader::get()->queueInMainThread([] { + auto self = static_cast(PlayLayer::get()); + if (!self) return; + + self->rescheduleSelectors(); + CCScheduler::get()->scheduleSelector(schedule_selector(GlobedPlayLayer::selUpdate), self->getParent(), 0.0f, false); }); m_fields->progressBarWrapper = Build::create() @@ -184,6 +187,15 @@ void GlobedPlayLayer::onQuit() { nm.suppressUnhandledFor(util::time::seconds(1)); } +void GlobedPlayLayer::destructor() { + if (PlayLayer::get() == this) { + GameManager::get()->m_playLayer = nullptr; + GameManager::get()->m_gameLayer = nullptr; + } + + PlayLayer::~PlayLayer(); +} + void GlobedPlayLayer::setupPacketListeners() { auto& nm = NetworkManager::get(); diff --git a/src/hooks/play_layer.hpp b/src/hooks/play_layer.hpp index 26acd4db..ce04e582 100644 --- a/src/hooks/play_layer.hpp +++ b/src/hooks/play_layer.hpp @@ -45,6 +45,7 @@ class $modify(GlobedPlayLayer, PlayLayer) { bool init(GJGameLevel* level, bool p1, bool p2); void onQuit(); + void destructor(); /* setup stuff to make init() cleaner */