static guint
module_prefs_unstash(module_t *module, gpointer data)
{
    gboolean *must_redissect_p = (gboolean *)data;

    module->prefs_changed = FALSE;        /* assume none of them changed */
    for (GList *pref_l = module->prefs; pref_l && pref_l->data; pref_l = g_list_next(pref_l)) {
        pref_t *pref = (pref_t *) pref_l->data;

        if (pref->type == PREF_OBSOLETE || pref->type == PREF_STATIC_TEXT) continue;

        pref_unstash(pref, &module->prefs_changed);
    }

    /* If any of them changed, indicate that we must redissect and refilter
       the current capture (if we have one), as the preference change
       could cause packets to be dissected differently. */
    if (module->prefs_changed)
        *must_redissect_p = TRUE;

    if(prefs_module_has_submodules(module))
        return prefs_modules_foreach_submodules(module, module_prefs_unstash, data);

    return 0;     /* Keep unstashing. */
}
void PreferenceEditorFrame::on_okButton_clicked()
{
    bool apply = false;
    switch(pref_->type) {
    case PREF_UINT:
        if (pref_->stashed_val.uint != new_uint_) {
            pref_->stashed_val.uint = new_uint_;
            apply = true;
        }
        break;
    case PREF_STRING:
        if (new_str_.compare(pref_->stashed_val.string) != 0) {
            g_free(pref_->stashed_val.string);
            pref_->stashed_val.string = qstring_strdup(new_str_);
            apply = true;
        }
        break;
    case PREF_RANGE:
        if (!ranges_are_equal(pref_->stashed_val.range, new_range_)) {
            g_free(pref_->stashed_val.range);
            pref_->stashed_val.range = range_copy(new_range_);
            apply = true;
        }
        break;
    default:
        break;
    }

    if (apply && module_) {
        pref_unstash(pref_, &module_->prefs_changed);
        prefs_apply(module_);
        if (!prefs.gui_use_pref_save) {
            prefs_main_write();
        }
    }
    on_cancelButton_clicked();
    // Emit signals once UI is hidden
    if (apply) {
        wsApp->emitAppSignal(WiresharkApplication::PacketDissectionChanged);
        wsApp->emitAppSignal(WiresharkApplication::PreferencesChanged);
    }
}