Fix losing the other selection contents in wxClipboard
The memory leak fix in b52728a62a (Fix memory leak of wxClipboard data on exit, 2023-06-21) was too eager and destroyed not just the currently used selection (e.g. primary), but also the other one (secondary) when Clear() was called, which was wrong and resulted in the loss of clipboard contents when discarding the primary selection in wxSTC, for example. Fix this by only deleting the object corresponding to the selection which we're clearing. See #23661, #23988. (cherry picked from commit dc6a0c069bdde714f22cb0459efd9ad186ce7179)
This commit is contained in:
parent
0b0437af20
commit
c816229fc3
@ -239,6 +239,10 @@ All (GUI):
|
||||
|
||||
- Fix refreshing multiple selection items in generic wxListCtrl.
|
||||
|
||||
wxGTK:
|
||||
|
||||
- Fix losing clipboard contents due to a regression in 3.2.3.
|
||||
|
||||
wxMSW:
|
||||
|
||||
- Fix MSVS warning about redundant "const" in wx/itemid.h (#23590).
|
||||
|
@ -594,12 +594,17 @@ void wxClipboard::Clear()
|
||||
else
|
||||
{
|
||||
// We need to free our data directly to avoid leaking memory.
|
||||
if ( m_usePrimary )
|
||||
{
|
||||
delete m_dataPrimary;
|
||||
m_dataPrimary = NULL;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_dataClipboard;
|
||||
m_dataClipboard = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
m_targetRequested = 0;
|
||||
m_formatSupported = false;
|
||||
|
Loading…
Reference in New Issue
Block a user