This repository was archived by the owner on Aug 31, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Fix clipboard ownership checks on windows causing private clipboard data to be cleared
Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ void MCWin32RawClipboardCommon::Clear()
149149 if (m_item)
150150 m_item->Release ();
151151 m_item = NULL ;
152+ CreateNewItem ();
152153}
153154
154155bool MCWin32RawClipboardCommon::IsExternalData () const
@@ -660,10 +661,15 @@ MCStringRef MCWin32RawClipboardCommon::CopyTypeForAtom(UINT p_atom)
660661
661662bool MCWin32RawClipboard::IsOwned () const
662663{
664+ // Get the IDataObject that we are placing onto the clipboard
665+ IDataObject* t_data_object = NULL ;
666+ if (m_item != NULL )
667+ t_data_object = m_item->GetIDataObject ();
668+
663669 // Check if our data object is the current clipboard data object
664- if (m_item == NULL )
665- return false ;
666- return S_OK == OleIsCurrentClipboard (m_item-> GetIDataObject () );
670+ if (t_data_object == NULL )
671+ return true ;
672+ return S_OK == OleIsCurrentClipboard (t_data_object );
667673}
668674
669675
@@ -694,7 +700,7 @@ bool MCWin32RawClipboard::PushUpdates()
694700bool MCWin32RawClipboard::PullUpdates ()
695701{
696702 // If we're still the owner of the clipboard, do nothing
697- if (IsOwned ())
703+ if (m_item != NULL && IsOwned ())
698704 return true ;
699705
700706 // Release the current clipboard contents
You can’t perform that action at this time.
0 commit comments