Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Nov 27, 2024
1 parent 00b7694 commit 3e00ab7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/network/ws/wssocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ void WSSocket::on_message(const websocketpp::connection_hdl &hdl, const message_
}

std::string s{msg->get_payload().data(), msg->get_payload().size()};
#if !NDEBUG
cs << "A message: " << msg->get_payload().size() << " " << msg->get_payload() << '\n';
#endif

incoming_queue.emplace_back(queue_item{a, std::move(s)});
}
Expand Down
3 changes: 2 additions & 1 deletion src/script/cpp_api/s_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ ScriptApiBase::ScriptApiBase(ScriptingType type):
#ifdef SCRIPTAPI_LOCK_DEBUG
m_lock_recursion_count = 0;
#endif

m_luastack = luaL_newstate();
FATAL_ERROR_IF(!m_luastack, "luaL_newstate() failed");

Expand Down Expand Up @@ -497,7 +498,7 @@ void ScriptApiBase::objectrefGetOrCreate(lua_State *L, ServerActiveObject *cobj)
errorstream << "ScriptApiBase::objectrefGetOrCreate(): "
<< "Pushing orphan ObjectRef. Please open a bug report for this."
<< std::endl;
assert(0);
//assert(0);
ObjectRef::create(L, cobj);
} else {
push_objectRef(L, cobj->getId());
Expand Down
2 changes: 1 addition & 1 deletion src/script/cpp_api/s_entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void ScriptApiEntity::luaentity_GetProperties(u16 id,
bool ScriptApiEntity::luaentity_Step(u16 id, float dtime,
const collisionMoveResult *moveresult)
{
TRY_SCRIPTAPI_PRECHECKHEADER({})
TRY_SCRIPTAPI_PRECHECKHEADER(true)

int error_handler = PUSH_ERROR_HANDLER(L);

Expand Down
5 changes: 5 additions & 0 deletions src/server/activeobjectmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ void ActiveObjectMgr::removeObject(u16 id)

void ActiveObjectMgr::invalidateActiveObjectObserverCaches()
{
const auto lock = m_active_objects.try_lock_shared_rec();
if (!lock->owns_lock()) {
return;
}

for (auto &active_object : m_active_objects.iter()) {
ServerActiveObject *obj = active_object.second.get();
if (!obj)
Expand Down

0 comments on commit 3e00ab7

Please sign in to comment.