Ethereal-dev: [Ethereal-dev] ethereal crash after apply on preferences

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

From: Nina Pham <nina@xxxxxxxxxxx>
Date: Tue, 12 Apr 2005 16:07:20 -0700
I'm trying to make a preference for my protocol following the readme.developer, and some examples in the src. The preference is based on the tcp port. Ethereal crashes whenever I change the port to the default port(global_myprot_tcp_port). However, it works just fine after it crashed, e.g, ethereal close after crashing, then I open ethereal, the port that I changed has been saved and applied. Any idea? Following is the code of reg_handoff which has pref part in it. Thanks
*
void proto_reg_handoff_myprot(void)
{
   static int myprot_prefs_initialized = FALSE;
   dissector_handle_t myprot_handle;

   if (!myprot_prefs_initialized) {
myprot_handle = create_dissector_handle(dissect_myprot, proto_myprot);
       myprot_prefs_initialized = TRUE;
   } else {
       dissector_delete("tcp.port", myprot_tcp_port, myprot_handle);
   }

   myprot_tcp_port = global_myprot_tcp_port;

   dissector_add("tcp.port", myprot_tcp_port, myprot_handle);
}*