Skip to content

p3i2psam3: Fix mutex copying bug causing crash on Windows#271

Merged
csoler merged 1 commit intoRetroShare:masterfrom
jolavillette:Fix_p3i2psam3
Feb 24, 2026
Merged

p3i2psam3: Fix mutex copying bug causing crash on Windows#271
csoler merged 1 commit intoRetroShare:masterfrom
jolavillette:Fix_p3i2psam3

Conversation

@jolavillette
Copy link
Contributor

@jolavillette jolavillette commented Feb 23, 2026

Problem
The code was incorrectly performing a bitwise copy of an RsMutex object before locking it:

auto l = this->mLockSam3Access; // Error: Creates a copy
RS_STACK_MUTEX(l);

On Windows/MinGW, copying a mutex is invalid and causes pthread_mutex_lock to return EINVAL. This triggers a logging path that crashes in ntdll!RtlAllocateHeap.

Fix
Lock the mutex member directly instead of using an intermediate variable. This ensures correct synchronization and prevents the EINVAL error and the subsequent fatal chain reaction on Windows.

@csoler csoler merged commit d88a7ad into RetroShare:master Feb 24, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants