[Gambas-devel] Segmentation fault / qt component

Benoit Minisini gambas at ...1...
Sun Dec 26 15:57:50 CET 2004


On Friday 24 December 2004 14:10, Daniel Campos wrote:
> Hi Benoit:
>
> This code finish with a segmentation fault:
>
> PUBLIC SUB Button1_MouseDown()
>
>   DIM hCur AS Cursor
>
>   hCur=NEW Cursor(NULL)
>   Button1.Cursor =hCur
>
> END
>
> I proppose the following patch at Cmouse.cpp in gb.qt:
>
>
> BEGIN_METHOD(CCURSOR_new, GB_OBJECT picture; GB_INTEGER x; GB_INTEGER y)
>
>   CPICTURE *pict = (CPICTURE *)VARG(picture);
>
>   THIS->x = VARGOPT(x, -1);
>   THIS->y = VARGOPT(y, -1);
>
>   if (!pict)
>       THIS->cursor =  new QCursor(QPixmap(), THIS->x, THIS->y);
>   else
>       THIS->cursor = new QCursor(*(pict->pixmap), THIS->x, THIS->y);
>
> END_METHOD
>
> When "picture" is null, a default cursor is created, instead of crashing.
>
> Regards,
>
> Daniel Campos
>

Is it useful to create a void cursor ? Isn't it better to raise an error 
instead ?

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




More information about the Devel mailing list