diff options
author | Mikael Kanstrup <mikael.kanstrup@gmail.com> | 2016-03-19 09:36:57 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-12-25 12:46:09 +0000 |
commit | e7287ca66f503d6fbabeb6b5c32729ef434aa43a (patch) | |
tree | cc84895c9c9da3eb627822710e3b9213626a9d60 /ui | |
parent | 33ee02ec73e39d5bfda19bc52ae1f53478a33b4a (diff) | |
download | wireshark-e7287ca66f503d6fbabeb6b5c32729ef434aa43a.tar.gz wireshark-e7287ca66f503d6fbabeb6b5c32729ef434aa43a.tar.bz2 wireshark-e7287ca66f503d6fbabeb6b5c32729ef434aa43a.zip |
Avoid recursive scan_local_interfaces operation
When the local networks interfaces changes quickly or when refreshing the
list of network interfaces there's a risk of recursive calls into
scan_local_interfaces. The recursive calls are a result of calling
update_cb to process UI events during function operation which in turn
again discover a network interface change. This results in strange
duplicate entries of network interfaces and crashes.
To avoid recursive calls a check is added to stop running the function while
already updating. This patch is really just a workaround for the problem.
Ideally some asynchronous operation should be implemented instead to avoid
the UI update_cb callback alltogether.
Bug: 11553
Bug: 12263
Change-Id: I3b74d8f196677e0e261a395aff558dd9f685b538
Reviewed-on: https://code.wireshark.org/review/14492
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
(cherry picked from commit 802362ee1a44d4a6494092f40e61155569ee5a6a)
Reviewed-on: https://code.wireshark.org/review/19427
Diffstat (limited to 'ui')
-rw-r--r-- | ui/iface_lists.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ui/iface_lists.c b/ui/iface_lists.c index 429cc0f67e..b53c2cb955 100644 --- a/ui/iface_lists.c +++ b/ui/iface_lists.c @@ -110,7 +110,17 @@ scan_local_interfaces(void (*update_cb)(void)) GString *ip_str; interface_options interface_opts; gboolean found = FALSE; + static gboolean running = FALSE; + if (running) { + /* scan_local_interfaces internally calls update_cb to process UI events + to avoid stuck UI while running possibly slow operations. A side effect + of this is that new interface changes can be detected before completing + the last one. + This return avoids recursive scan_local_interfaces operation. */ + return; + } + running = TRUE; if (global_capture_opts.all_ifaces->len > 0) { for (i = (int)global_capture_opts.all_ifaces->len-1; i >= 0; i--) { @@ -361,6 +371,7 @@ scan_local_interfaces(void (*update_cb)(void)) global_capture_opts.num_selected++; } } + running = FALSE; } /* |