ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] What is the use of pointer "cap_file_" in QtShark

From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Wed, 22 May 2013 11:53:07 -0700
On 5/22/13 10:21 AM, Richard Turner wrote:
> In Wireshark/ui/qt/main_window.h there is a private member variable
> defined as:
> 
> capture_file *cap_file_;
> 
> I think it's a pointer to the global variable "cfile" (defined in
> tshark.c).
> 
> Is it true that we keep this pointer only to verify the validity of
> cfile (we set cap_file_ to NULL when the capture file is closed)?

The intent was to associate a capture_file with a MainWindow instead of
with the entire application. I've been trying to avoid the use of
globals.h and the global cfile variable in particular in the Qt code in
case we ever manage to support having more than one capture file open.
Using it to determine if we have an open capture file followed from that.