Re: GTK+2 - GtkFileChooserButton shows (none) as selected folder and crashes



On Friday 18 October 2013 21:43:27 Alessandro Francesconi wrote:
Some of my application’s users declare a strange problem with a particular widget: GtkFileChooserButton.


I needed to provide a way to select a single folder, so I used the widget this way:


GtkWidget* button_outfolder = gtk_file_chooser_button_new(_("Select output folder"), 
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
output_folder_string = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(button_outfolder)); // store the 
default value
gtk_widget_set_size_request(button_outfolder, 180, 30);




The problem is that, when the widget is displayed for the first time, it shows the text “(none)” instead of 
a default folder’s name. When the user clicks on it to select a valid path, the entire program crashes with 
a segfault (I can’t provide further information right now).


This thing does not happen to everyone: for example, I’ve never seen this behaviour with my systems 
(Windows 7/8, 64bit, GTK+ 2.22 and Linux 64bit with GTK+ 3), but some other users with apparently the same 
environments are experiencing it.


I tried to workaround this issue by forcing the default folder at startup with:


gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(button_outfolder), "");


Nothing to do, the problem remains for “someone”.


Did anyone ever experience this bug? Is it reported somewhere? Am I doing something wrong in my code?




Thank you!

Ale

Hi,
this worked for me on xp and win7.


if (folder) {
                tmp = g_locale_to_utf8((folder), -1, NULL, NULL, NULL);
                gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), tmp);
                g_free(tmp);
        }


Ciao,
zz


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]