[Gambas-devel] Qt component / Segmentation fault

Benoit Minisini gambas at ...1...
Mon Jan 3 14:55:11 CET 2005


On Monday 03 January 2005 12:20, Laurent Carlier wrote:
> 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,

Mmm. It is a bug in QT, not in Gambas! :-)

I will fix it, but not by converting an int to an unsigned int! Horrible!

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list