void SimpleStatisticsDialog::fillTree()
{
    new_stat_data_t stat_data;
    stat_data.new_stat_tap_data = stu_;
    stat_data.user_data = this;

    stu_->stat_tap_init_cb(stu_, NULL, NULL);

    GString *error_string = register_tap_listener(stu_->tap_name,
                          &stat_data,
                          displayFilter(),
                          0,
                          tapReset,
                          stu_->packet_func,
                          tapDraw);
    if (error_string) {
        QMessageBox::critical(this, tr("Failed to attach to tap \"%1\"").arg(stu_->tap_name),
                             error_string->str);
        g_string_free(error_string, TRUE);
        free_stat_tables(stu_, NULL, NULL);
        reject();
    }

    cap_file_.retapPackets();

    tapDraw(&stat_data);

    remove_tap_listener(&stat_data);
    free_stat_tables(stu_, NULL, NULL);
}
void SimpleStatisticsDialog::fillTree()
{
    new_stat_data_t stat_data;
    stat_data.new_stat_tap_data = stu_;
    stat_data.user_data = this;

    stu_->stat_tap_init_cb(stu_, NULL, NULL);

    QString display_filter = displayFilter();
    if (!registerTapListener(stu_->tap_name,
                             &stat_data,
                             display_filter.toUtf8().constData(),
                             0,
                             tapReset,
                             stu_->packet_func,
                             tapDraw)) {
        free_stat_tables(stu_, NULL, NULL);
        reject(); // XXX Stay open instead?
        return;
    }

    cap_file_.retapPackets();

    tapDraw(&stat_data);

    removeTapListeners();
    free_stat_tables(stu_, NULL, NULL);
}