Re: [gnome-love] New file selector?



On Wed, 2004-11-17 at 08:38 +0000, nelson wrote:

#if GTK_CHECK_VERSION(2,4,0)
              
gtk_entry_set_text(GTK_ENTRY(app->fileentry),gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_selector)));
#else

This, unfortunately, is a memory leak, as
gtk_file_chooser_get_filename() returns a newly allocated string, which
you must free. Try this instead:

#if GTK_CHECK_VERSION(2,4,0)
        gchar *filename =
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_selector));
        gtk_entry_set_text (GTK_ENTRY (app->fileentry),filename);
        g_free (filename);
#else

-- 
Peace,

    Jim Cape
    http://esco.mine.nu
    http://ignore-your.tv

    "If even one reporter had stood up during a pre-Iraq Bush press
     conference last year and shouted, `Bullshit!' it might have made a
     difference."
        -- Matt Taibbi, New York Press

Attachment: signature.asc
Description: This is a digitally signed message part



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