Ethereal-dev: RE: [Ethereal-dev] Bug in capture menu

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

From: "Peter Kjellerstedt" <peter.kjellerstedt@xxxxxxxx>
Date: Wed, 9 Feb 2005 18:30:38 +0100
> -----Original Message-----
> From: ethereal-dev-bounces@xxxxxxxxxxxx 
> [mailto:ethereal-dev-bounces@xxxxxxxxxxxx] On Behalf Of Ulf Lamping
> Sent: Tuesday, February 08, 2005 21:06
> To: Ethereal development
> Subject: Re: [Ethereal-dev] Bug in capture menu
> 
> Thomas Boehne wrote:
> 
> >When I click on Capture->Start and enter an invalid capture 
> >filter, an error message is displayed. (so far everything is OK). 
> 
> No, not *everything* was ok, as the capture filter was invalid ;-)))
> 
> Ok, ok, becoming serious again...
> 
> >But now the Capture->Start item is greyed out, and clicking on
> >Capture->Stop seems to do nothing. I have to restart ethereal to
> >continue.
> >
> Checked in a fix for this.
> 
> This was caused, as the cf_cb_live_capture_started event was 
> called too early. This way the cleanup, if an invalid filter was 
> specified, wasn't done enough, putting the main window into an 
> invalid state.
> 
> I've introduced a new event cf_cb_live_capture_prepare which it 
> triggered to do only what has to be done simply changing the main 
> windows title, but nothing more.
> 
> Regards, ULFL
> 
> P.S: I'm glad to fix a bug caused by Guy, although the 
> cause/fix ratio is about 200/1 against me, as he had fixed 
> *a lot more* of my bugs than I did the other way round :-)

After this fix I get the Welcome pane whenever I do a live 
capture. The reason is that the cf_cb_live_capture_started 
event is never called at all any more...

I added the following temporary fix to my tree to get it to 
work at all. This is of course not the correct way to do it,
but I did not have time to investigate it further.

Index: capture.c
===================================================================
--- capture.c	(revision 13359)
+++ capture.c	(working copy)
@@ -427,10 +427,13 @@
     ret = sync_pipe_do_capture(capture_opts, is_tempfile);
     /* capture is still running */
     cf_callback_invoke(cf_cb_live_capture_prepare, capture_opts);
+    cf_callback_invoke(cf_cb_live_capture_started, capture_opts);
   } else {
     /* normal mode: do the capture synchronously */
     cf_callback_invoke(cf_cb_live_capture_prepare, capture_opts);
+    cf_callback_invoke(cf_cb_live_capture_started, capture_opts);
     ret = normal_do_capture(capture_opts, is_tempfile);
+    cf_callback_invoke(cf_cb_live_capture_finished, capture_opts);
     /* capture is finished here */
   }
 

//Peter