[Qt] Qt fix for try..except in CopyUnicodeToPWideString()

zeljko zeljko at holobit.net
Tue Jun 26 17:17:28 CEST 2007


Hi,
I've located all problems and here is the fix.

1.Qt bindings (Den this is for you ;) ).
   bindhelp.h
   
inline void copyQStringToPWideString(const QString &qs, PWideString ps)
{
   copyUnicodeToPWideString(qs.unicode(), ps, qs.length());
}


should be 

inline void copyQStringToPWideString(const QString &qs, PWideString ps)
{
   if (qs != 0 && ps)  /* we must check our params  */
   copyUnicodeToPWideString(qs.unicode(), ps, qs.length());
}


2.qwidgets.pas in

function TQtLineEdit.CreateWidget(const AParams: TCreateParams): QWidgetH;

  Str := UTF8Decode((LCLObject as TCustomEdit).Text);
  Result := QLineEdit_create(@Str, Parent);

  should be

  Str := UTF8Decode((LCLObject as TCustomEdit).Text);
  if Length(Str) = 0 then 
  Str := #0;
  Result := QLineEdit_create(@Str, Parent);

I've founded only in QLineEdit that empty string initalization (length of Str 
is 0) raises AV.

now, after recompiling bindings, and fix in TQtLineEdit constructor, you can 
remove try .. except and test.

Any feedback is welcome ;)

zeljko
 



More information about the Qt mailing list