Commit b0aef059 authored by Juha Manninen's avatar Juha Manninen
Browse files

LCL-GTK2: Don't add a a useless #0 when transforming clipboard data to compound text.

git-svn-id: trunk@53380 -
parent 5ac17298
......@@ -3590,9 +3590,8 @@ var
P: PChar;
begin
BufLength:=integer(MemStream.Size);
P:=StrAlloc(BufLength+1);
P:=StrAlloc(BufLength);
MemStream.Read(P^,BufLength);
P[BufLength]:=#0;
Buffer:=nil;
BufLength:=0;
gdk_string_to_compound_text(P,
......@@ -3611,10 +3610,10 @@ var
begin
BufLength:=integer(MemStream.Size);
GetMem(Buffer,BufLength);
Assert(Assigned(Buffer), 'ClipboardSelectionRequestHandler: Buffer = Nil');
Assert(Assigned(Buffer) and (BufLength>0), 'SetData: GTK2 clipboard Buffer=Nil or empty.');
MemStream.Read(Buffer^,BufLength);
// Issue #21453. gtk_selection_data_set adds the required null. Remove it here.
if (BufLength>0) and (PChar(Buffer+BufLength-1)^ = #0) then
if PChar(Buffer+BufLength-1)^ = #0 then
dec(BufLength);
gtk_selection_data_set(SelectionData,SelectionData^.Target,8,Buffer,BufLength);
FreeMem(Buffer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment