Project

General

Profile

Actions

Bug #33

closed

Check dynamic cast successfull in plugIn

Added by Vincenzo Cimino 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
High
Target version:
Start date:
11/19/2025
Due date:
% Done:

0%

Estimated time:

Description

Inside the methodPlugIn::recvSyncClMsg(ClMessage *m) a check on dynamic casts is needed.
Fix:

int
PlugIn::recvSyncClMsg(ClMessage *m)
{
    if (m->type() == CLMSG_DISCOVERY) {
        Tcl &tcl = Tcl::instance();
        tcl.evalf("%s info class", name());
        const char *class_name = tcl.result();
        auto dyn_msg = dynamic_cast<ClMsgDiscovery *>(m);
        if (dyn_msg != nullptr) {
            dyn_msg->addData((const PlugIn *) this,
                        getLayer(),
                        getStackId(),
                        getId(),
                        class_name,
                        getTag());
            return 0;
        }
    } else if (m->type() == CLMSG_STATS) {
        auto dyn_msg = dynamic_cast<ClMsgStats *>(m);
        if (dyn_msg != nullptr) {
            dyn_msg->setStats(stats_ptr);
            return 0;
        }
    }
    // return error in case of wrong type id or dynamic cast error
    return RETVAL_NOT_IMPLEMENTED;
}
Actions #1

Updated by Vincenzo Cimino 5 months ago

  • Status changed from New to In Progress
Actions #2

Updated by Vincenzo Cimino 5 months ago

  • Status changed from In Progress to Closed
Actions

Also available in: Atom PDF