[Gambas-devel] Qt component / Segmentation fault

Laurent Carlier lordheavy at ...141...
Mon Jan 3 12:20:48 CET 2005


Le Lundi 3 Janvier 2005 11:52, Daniel Campos a écrit :
> >Because it must be an unsigned value. Here you should do :
> >TextBox1.Pos= TextBox1.Pos - 4
> >
> >Currently it seems that -4 is converted to an unsigned value so going "out
> > of range" of the text -> segfault !
> >
> >Regards,
>
> Yes, but it must be fixed, no segfaults are allowed in Gambas in 2005 :-)))
>
> Regards,
>
> D. Campos
>
>
small fix :

BEGIN_PROPERTY(CTEXTBOX_pos)

  GET_TEXT_BOX();

  if (READ_PROPERTY)
    GB.ReturnInteger(textbox->cursorPosition());
  else
    {
      unsigned int _pos = VPROP(GB_INTEGER);
      
      if (_pos > textbox->text().length())
        _pos = textbox->text().length();
 
      textbox->setCursorPosition(_pos);
    }
      
END_PROPERTY

Regards,

-- 

Laurent Carlier




More information about the Devel mailing list