checking status of GString



I have a callback that is called when I exit the main window:

void main_destroy_cb (GtkWidget *widget, GWindow *gfind)
{
    g_string_free(gfind->cmd, TRUE);
    g_free(gfind->entry);
    g_free(gfind);
    gtk_main_quit();
}

The GString gfind->cmd is initialize in the function that calls this
callback, which means that on exit, my program is assuming that
gfind->cmd has been initialized.  I thought that this would work to
check it:

if(gfind->cmd != NULL)
    g_string_free(gfind->cmd, TRUE);

which didn't work, so I tried:

if(gfind->cmd->str != NULL)
    g_string_free(gfind->cmd, TRUE);

which also did not work (segfaults).

I am trying to avoid initializing the GString right away, to prevent
this.  I would just like to check if it is null or not.

Any ideas?

Thanks,
Aaron

--
Visit my web site at http://iconmedia.com/cgi-bin/index.pl

Current uptime:
  7:22pm  up 21:19,  1 user,  load average: 1.50, 1.38, 1.22





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