Make wxMSW tree item unlocking reentrant.
Handle creating nested TreeItemUnlocker objects correctly. This fixes the problem when a wxTreeCtrl method unlocking some item is called with another item is already unlocked, e.g. from a selection changed event handler. Closes #14400. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -590,6 +590,8 @@ MSW:
|
|||||||
- Add VT_I8 support to wxAutomationObject (PB).
|
- Add VT_I8 support to wxAutomationObject (PB).
|
||||||
- Fix wxListbook size calculations to avoid spurious scrollbars.
|
- Fix wxListbook size calculations to avoid spurious scrollbars.
|
||||||
- Fix code compilation with wxUSE_UNICODE_UTF8 (Kolya Kosenko).
|
- Fix code compilation with wxUSE_UNICODE_UTF8 (Kolya Kosenko).
|
||||||
|
- Fix crash in wxTreeCtrl when calling GetSelection() from selection changed
|
||||||
|
event handler under Vista and later (sbrowne).
|
||||||
|
|
||||||
OSX:
|
OSX:
|
||||||
|
|
||||||
|
@@ -84,13 +84,21 @@ class TreeItemUnlocker
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// unlock a single item
|
// unlock a single item
|
||||||
TreeItemUnlocker(HTREEITEM item) { ms_unlockedItem = item; }
|
TreeItemUnlocker(HTREEITEM item)
|
||||||
|
{
|
||||||
|
m_oldUnlockedItem = ms_unlockedItem;
|
||||||
|
ms_unlockedItem = item;
|
||||||
|
}
|
||||||
|
|
||||||
// unlock all items, don't use unless absolutely necessary
|
// unlock all items, don't use unless absolutely necessary
|
||||||
TreeItemUnlocker() { ms_unlockedItem = (HTREEITEM)-1; }
|
TreeItemUnlocker()
|
||||||
|
{
|
||||||
|
m_oldUnlockedItem = ms_unlockedItem;
|
||||||
|
ms_unlockedItem = (HTREEITEM)-1;
|
||||||
|
}
|
||||||
|
|
||||||
// lock everything back
|
// lock everything back
|
||||||
~TreeItemUnlocker() { ms_unlockedItem = NULL; }
|
~TreeItemUnlocker() { ms_unlockedItem = m_oldUnlockedItem; }
|
||||||
|
|
||||||
|
|
||||||
// check if the item state is currently locked
|
// check if the item state is currently locked
|
||||||
@@ -99,6 +107,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static HTREEITEM ms_unlockedItem;
|
static HTREEITEM ms_unlockedItem;
|
||||||
|
HTREEITEM m_oldUnlockedItem;
|
||||||
|
|
||||||
|
wxDECLARE_NO_COPY_CLASS(TreeItemUnlocker);
|
||||||
};
|
};
|
||||||
|
|
||||||
HTREEITEM TreeItemUnlocker::ms_unlockedItem = NULL;
|
HTREEITEM TreeItemUnlocker::ms_unlockedItem = NULL;
|
||||||
|
Reference in New Issue
Block a user