Jinoh Kang (@iamahuman) commented about dlls/win32u/winstation.c:
- const session_shm_t *shared;
+};
+/* acquire a weak reference on a session */ +static void shared_session_acquire_weak( struct shared_session *session ) +{
- int ref = InterlockedIncrement( &session->weak_ref );
- TRACE( "session %p incrementing weak_ref to %d\n", session, ref );
+}
+/* try acquiring a strong reference from a possibly weak referenced session */ +static struct shared_session *shared_session_acquire( struct shared_session *session ) +{
- if (InterlockedOr( &session->ref, 0 ))
- {
int ref = InterlockedIncrement( &session->ref );
It looks like we have a race: another thread may invalidate `shared_session` just before here. Is it true?
* In that case, consulting `dlls/combase/marshal.c:proxy_manager_addref_if_alive()` might be a help.
* Otherwise, please explain (in comments) how it's not possible for `ref` to concurrently drop to zero.