[Gambas-user] CDialog question in context signal11

Benoit Minisini gambas at ...2...
Sat Sep 20 16:42:24 CEST 2003


Le Samedi 20 Septembre 2003 16:16, R Onstenk a écrit :
> I read the KDE component CDialog file
>
> BEGIN_METHOD_VOID(CDIALOG_open_file)
>
>   QString file;
>   GB_STRING str;
>
>   file = KFileDialog::getOpenFileName(dialog_path, dialog_filter, 0,
> dialog_title);
>
>   if (file.isNull())
>     GB.ReturnBoolean(true);
>   else
>   {
>     (const char *)str.value.addr = file;
>     str.value.len = file.length();
>     GB.StoreString(&str, &dialog_path);
>     GB.ReturnBoolean(false);
>   }
>
> END_METHOD
>
> The dialog opens before the crash with signal11.
> When I press the Open/Save or cancel button the crash occurs.
> My question is:
> If KFileDialog returns in 'file' the selected file then 'file' is not NULL
> as I asume.
> In this case the 'else' will be done.
> Here I think is a problem
>     str.value.len = file.length();
>     GB.StoreString(&str, &dialog_path);
>
> Here you look to the length of the 'file' string but you copy
> the initial 'dialog_path' and that is not the 'file' selected.

No. GB.StoreString stores its first argument into its second one.

> If the arguments for the KFileDialog are passed by value then it
> can't be the selected file on return.
> For shure the length do not match if the selected file name differs
> in length or other directory from what is passed on the call.
> Is the signal11 a overflow of the str.value.len?
>

Note that the code of CDIALOG_open_file in the KDE component is the same as 
the QT component one ! (except the name of the API).

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




More information about the User mailing list