|
oapiSendMFDKey crash with ExternMFD
oapiSendMFDKey() crashes when invoked on MFD handled by class derived from ExternMFD
Consider the following code:
#define XSIZE 400
#define YSIZE 400
MFDSPEC spec = {{0,0,XSIZE,YSIZE},6,6,YSIZE/12,YSIZE/6};
Later, in clbkPreStep() of some module:
ExternMFD *mfd = new ExternMFD(spec);
oapiSendMFDKey(mfd->Id(), OAPI_KEY_F1);
This code crashes with segmentation violation in oapiSendMFDKey.
According to documentation, ExternMFD::Id() returns object's this pointer cast to UINT. On the other hand, built-in MFDs have IDs equal to 0, 1, ... and so on. Thus, it appears that oapiSendMFDKey incorrectly dereferences MFD IDs issued by ExternMFD.
|