Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / qt / 2007-05

problem with CopyUnicodeToPWideString() from qt4.pas

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

zeljko

Hi,

I'm implementing TCustomEdit OnChange event, and found that qt4.CopyUnicodeToPWideString() raises AV

{$IFDEF LINUX}
begin
  SetLength(S, Len);  <-------------------- HERE IS AV
  Move(Unicode[0],S[1],Len*2);
end;
{$ENDIF}

so I added an small workaround, not QLineEdit_textChanged_Event properly works:

{$IFDEF LINUX}
begin
  try
  SetLength(S, Len);  <-------------------- HERE IS AV
  except
     exit;
  end;
  Move(Unicode[0],S[1],Len*2);
end;
{$ENDIF}

After adding try..except everything works fine.
What are you guys think about this ? FPC bug ?

Felipe, please apply my last patch withTQtWSCustomEdit update.

cheers,
zeljko

Felipe Monteiro de Carvalho
to zeljko
zeljko wrote
After adding try..except everything works fine. What are you guys think about this ? FPC bug ?

Which fpc version are you using? If 2.0.4 you could try the beta 2.1.4. If this fixes the problem, then this is a 2.0.4 problem that will disappear when 2.2 is released

On linux it's easy to uninstall a compiler and install another using rpm packages

Felipe Monteiro de Carvalho
zeljko
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 7 lines
On 5/31/07, zeljko wrote: > After adding try..except everything works fine. > What are you guys think about this ? FPC bug ? Which fpc version are you using? If 2.0.4 you could try the beta 2.1.4. If this fixes the problem, then this is a 2.0.4 problem that will disappear when 2.2 is released

fpc-2.0.4-20070521 , is it possible to add compiler directive like inside this routine, cause we'll get unneeded bug reports about AV when I send QXXX_textChanged_Event() patches.

{$IFDEF FPCVERXXX}
try
SetLength(s, Len);
except
 exit;
end;
{$ELSE}
SetLength(s, Len);
{$END}

or even better if we want to avoid IFDEFS in qt4.CopyUnicodeToPWideString(), fpc have SetString() routine which is same as in win or mac port. I'll try with beta, and then send results here.