aboutsummaryrefslogtreecommitdiffstats
path: root/epan/prefs.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2015-06-24 11:52:19 -0700
committerEvan Huus <eapache@gmail.com>2015-06-24 19:48:09 +0000
commitec094b5cc1b1a94ffa60ed7ba30443013cc45c02 (patch)
treef490b4f9ee13e62f08d5e91d78638cf923181c04 /epan/prefs.c
parent137c49535258f96371b2523cb64b6d9a9d866dc4 (diff)
Initialize default stats before using them
Quick hack fix for bug 11275. The longer fix I am still thinking about, but it goes something like this: we have a terribly confusing dependency graph in ordering our various preferences, so it's fragile and needs refactoring. 1. We must call epan_init before we read the preferences files, since dissectors register many preferences. 2. We must call pre_init_prefs before we call prefs_register_modules, since that inits the default values of the "global" preferences structure. `init_prefs()` handles this normally. 3. We must call epan_init before we call init_prefs since init_prefs depends on UATs being initialized (which is something epan_init does). 4. We must call prefs_register_modules before we call epan_init since that generates the `protocols` subtree which is needed for registering dissector-specific preferences. The above graph has a cycle, which I *think* can be solved by splitting prefs_register_modules? Bug: 11275 Change-Id: I08dae6a7ade178896e0de5e5091f7eeaca95846f Reviewed-on: https://code.wireshark.org/review/9098 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/prefs.c')
-rw-r--r--epan/prefs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/prefs.c b/epan/prefs.c
index 6d9e3d01d7..93d9bdcbb6 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -436,6 +436,7 @@ prefs_register_protocol(int id, void (*apply_cb)(void))
* No. Register Protocols subtree as well as any preferences
* for non-dissector modules.
*/
+ pre_init_prefs();
prefs_register_modules();
}
protocol = find_protocol_by_id(id);
@@ -463,6 +464,7 @@ prefs_register_protocol_subtree(const char *subtree, int id, void (*apply_cb)(vo
* No. Register Protocols subtree as well as any preferences
* for non-dissector modules.
*/
+ pre_init_prefs();
prefs_register_modules();
}
@@ -522,6 +524,7 @@ prefs_register_protocol_obsolete(int id)
* No. Register Protocols subtree as well as any preferences
* for non-dissector modules.
*/
+ pre_init_prefs();
prefs_register_modules();
}
protocol = find_protocol_by_id(id);
@@ -557,7 +560,8 @@ prefs_register_stat(const char *name, const char *title,
* No. Register Statistics subtree as well as any preferences
* for non-dissector modules.
*/
- prefs_register_modules();
+ pre_init_prefs();
+ prefs_register_modules();
}
return prefs_register_module(stats_module, name, title, description,