[Gambas-user] CDialog question in context signal11

R Onstenk ronstk at ...239...
Sat Sep 20 16:16:12 CEST 2003


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.
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?

----
Ron





More information about the User mailing list