Hello all,

I did some more digging and it seems frmMain::OnSelRightClick is
trying to unlock a mutex it doesn't own, which can result in undefined
behaviour in POSIX.

I've attached a patch that moves the unlock inside the if where the
mutex is locked. This seems to fix the crash, at least on my end, but
I couldn't say if it affects thread safety at all.

Again, I hope this helps.

Kind regards,
Wander Nauta
From d17a268572648b8e45ba6dc5854549a1dbf81c0a Mon Sep 17 00:00:00 2001
From: Wander Nauta <i...@wandernauta.nl>
Date: Sun, 19 Apr 2015 16:37:41 +0200
Subject: [PATCH] Move misplaced unlock of s_currentObjectMutex

The current implementation would unlock the mutex, even if it didn't own
it.
---
 pgadmin/frm/events.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pgadmin/frm/events.cpp b/pgadmin/frm/events.cpp
index 4baaf42..f2ad570 100644
--- a/pgadmin/frm/events.cpp
+++ b/pgadmin/frm/events.cpp
@@ -750,11 +750,11 @@ void frmMain::OnSelRightClick(wxTreeEvent &event)
 		//
 		s_currentObjectMutex.Lock();
 		currentObject = browser->GetObject(item);
+		s_currentObjectMutex.Unlock();
 	}
 
 	if (currentObject)
 		doPopup(browser, event.GetPoint(), currentObject);
-	s_currentObjectMutex.Unlock();
 }
 
 
-- 
2.3.5

-- 
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Reply via email to