diff --git a/pgadmin/frm/events.cpp b/pgadmin/frm/events.cpp
index 556fc73..0e910bb 100644
--- a/pgadmin/frm/events.cpp
+++ b/pgadmin/frm/events.cpp
@@ -738,16 +738,17 @@ void frmMain::OnSelRightClick(wxTreeEvent &event)
 	if (item != browser->GetSelection())
 	{
 		browser->SelectItem(item);
+    }
 
-		// Prevent changes to "currentObject" by "execSelchange" function by another thread.
-		// Will hold the lock until we do popup on the respective object.
-		//
-		s_currentObjectMutex.Lock();
-		currentObject = browser->GetObject(item);
-	}
+	// Prevent changes to "currentObject" by "execSelchange" function by another thread.
+	// Will hold the lock until we do popup on the respective object.
+	//
+	s_currentObjectMutex.Lock();
+	currentObject = browser->GetObject(item);
 
 	if (currentObject)
 		doPopup(browser, event.GetPoint(), currentObject);
+
 	s_currentObjectMutex.Unlock();
 }
 
