Re: Odd segfault
- From: Jan-Marek Glogowski <glogow fbihome de>
- To: David <dbree duo-county com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Odd segfault
- Date: Sat, 15 May 2004 17:56:15 +0200 (CEST)
Hi
I guess the real error is this line:
gchar *title = g_strconcat("Select a ", type);
From GLib manual: The variable argument list must end with NULL. If you
forget the NULL, g_strconcat() will start appending random memory junk to
your string.
BTW: It's better to use gtk_dialog_run e.g. (from my mind and an example):
gchar *title = g_strconcat( "Select a ", type, NULL );
gchar *utf8 = g_locale_to_utf8( title, -1, NULL, NULL, NULL );
GtkWidget *selector = gtk_file_selection_new( utf8 );
g_free( utf8 );
gtk_window_set_modal( GTK_WINDOW( selector ), TRUE );
switch( gtk_dialog_run( GTK_DIALOG( selector ) ) )
{
case GTK_RESPONSE_OK:
filename = gtk_file_selection_get_filename( selector );
// * Do your "ok" stuff *
default:
gtk_widget_destroy( selector );
break;
}
HTH
Jan-Marek
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]