mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-30 10:09:13 +02:00
gtk interface: fixed memory corruption when pasting from clipboard fails and the sanity check is invoked
git-svn-id: trunk@11438 -
This commit is contained in:
parent
d81144b51a
commit
2566bffceb
@ -7487,23 +7487,24 @@ begin
|
||||
FillChar(c^.Data,SizeOf(TGtkSelectionData),0);
|
||||
ClipboardSelectionData.Add(c);
|
||||
{$IFDEF DEBUG_CLIPBOARD}
|
||||
DebugLn('[RequestSelectionData] TimeID=',dbgs(TimeID),' Type=',GdkAtomToStr(ClipboardTypeAtoms[ClipboardType]),' FormatID=',GdkAtomToStr(FormatID));
|
||||
DebugLn('[RequestSelectionData] TimeID=',dbgs(TimeID),' Type=',GdkAtomToStr(ClipboardTypeAtoms[ClipboardType]),' FormatID=',GdkAtomToStr(FormatID), ' Sanity=', IntToStr(Sanity));
|
||||
{$ENDIF}
|
||||
if gtk_selection_convert(ClipboardWidget, ClipboardTypeAtoms[ClipboardType],
|
||||
FormatID, TimeID)<>GdkFalse
|
||||
then
|
||||
then begin
|
||||
try
|
||||
if not WaitForClipboardAnswer(c) then exit;
|
||||
Result:=c^.Data;
|
||||
finally
|
||||
ClipboardSelectionData.Remove(c);
|
||||
Dispose(c);
|
||||
end;
|
||||
break;
|
||||
end;
|
||||
ClipboardSelectionData.Remove(c);
|
||||
Dispose(c);
|
||||
Inc(sanity);
|
||||
until false or (sanity > 1000000);
|
||||
try
|
||||
if not WaitForClipboardAnswer(c) then exit;
|
||||
Result:=c^.Data;
|
||||
finally
|
||||
ClipboardSelectionData.Remove(c);
|
||||
Dispose(c);
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user