Ethereal-dev: Re: [ethereal-dev] Popup packet window

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Tue, 29 Feb 2000 00:49:06 -0800
> I have a question/problem.  When I create the tree_view callbacks,
> I'm giving it a pointer to the g_malloc'ed data structure. I used
> the gtk_signal_connect_full function instead of the gtk_signal_connect 
> to add a destroy_func.  Is this the best way ? 

I think you can just do

	  gtk_signal_connect(GTK_OBJECT(main_w), "destroy",
				GTK_SIGNAL_FUNC(destroy_new_window), DataPtr);

and then have "destroy_new_window()" do:

	static void
	destroy_new_window(GtkObject *object, gpointer user_data)
	{
	  struct PacketWinData *DataPtr = user_data;

	  detail_windows = g_list_remove(detail_windows, DataPtr);
	  proto_tree_free(DataPtr->protocol_tree);
	  g_free(DataPtr->pd);
	  g_free(DataPtr);
	}

so that when a packet view popup window gets destroyed, the
PacketWinData structure that keeps track of it is removed from the list
of packet view popup windows and then destroyed.