Hi,
Can some one tell me if there is
a memory leak in this piece of code.top shows a continous increase in memory
usage whenever the dialog is run. Since I am not completely at home with widget
refs and unrefs, I am afraid I might be doing something wrong which I am not
aware of.
Thanx
Greetings
Vinny
void new_project_cb (GtkWidget *w,gpointer
data){
GtkWidget *dialog_window;
GtkWidget *druid; GtkWidget *druid_start_page; GtkWidget *druid_end_page; GtkWidget *druid_page1; GtkWidget *temp_label; GtkWidget *vbox; GdkImlibImage *logo,*watermark;
dialog_window = gtk_window_new
(GTK_WINDOW_DIALOG);
gtk_window_set_title (GTK_WINDOW(dialog_window),"New Project"); druid = gnome_druid_new (); logo = gdk_imlib_create_image_from_xpm_data
(aries_logo_xpm);
watermark = gdk_imlib_create_image_from_xpm_data (aries_watermark_xpm); druid_start_page = gnome_druid_page_start_new_with_vals ("New Project", "This druid will guide you through the process of creating a new project", logo,watermark); gnome_druid_append_page (GNOME_DRUID (druid),GNOME_DRUID_PAGE(druid_start_page)); druid_page1 = gnome_druid_page_standard_new_with_vals ("New Project",logo); temp_label = gtk_label_new ("Under Construction"); vbox = GNOME_DRUID_PAGE_STANDARD (druid_page1)->vbox; gtk_box_pack_start (GTK_BOX (vbox),temp_label,TRUE,TRUE,0); gtk_widget_show (vbox); gnome_druid_append_page (GNOME_DRUID (druid),GNOME_DRUID_PAGE (druid_page1)); druid_end_page = gnome_druid_page_finish_new_with_vals ("New Project", "Click on finish to create your new project", logo,watermark); gnome_druid_append_page (GNOME_DRUID (druid),GNOME_DRUID_PAGE(druid_end_page)); gtk_container_add (GTK_CONTAINER (dialog_window),druid); gtk_window_set_modal (GTK_WINDOW(dialog_window),TRUE); gtk_object_ref (GTK_OBJECT
(dialog_window));
gtk_signal_connect (GTK_OBJECT (druid_end_page),"finish",GTK_SIGNAL_FUNC (new_project_druid_done_cb),dialog_window); gtk_signal_connect (GTK_OBJECT (druid),"cancel",GTK_SIGNAL_FUNC (new_project_druid_cancel_cb),dialog_window); gtk_widget_show_all (dialog_window); gdk_imlib_destroy_image (logo); gdk_imlib_destroy_image (watermark); } static void new_project_druid_done_cb (GnomeDruidPage *page,gpointer druid,gpointer user_data){ gtk_object_unref (GTK_OBJECT (user_data)); gtk_object_destroy (GTK_OBJECT (user_data)); } static void new_project_druid_cancel_cb (GtkWidget *w,gpointer data){ gtk_object_unref (GTK_OBJECT (data)); gtk_object_destroy (GTK_OBJECT (data)); } |