MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / Delete

Method Delete

source/script2.cpp:14776–14798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14774
14775
14776void MsgMonitorList::Delete(MsgMonitorStruct *aMonitor)
14777{
14778 ASSERT(aMonitor >= mMonitor && aMonitor < mMonitor + mCount);
14779
14780 int mon_index = int(aMonitor - mMonitor);
14781 // Adjust the index of any active message monitors affected by this deletion. This allows a
14782 // message monitor to delete older message monitors while still allowing any remaining monitors
14783 // of that message to be called (when there are multiple).
14784 for (MsgMonitorInstance *inst = mTop; inst; inst = inst->previous)
14785 {
14786 inst->Delete(mon_index);
14787 }
14788 // Remove the item from the array.
14789 --mCount; // Must be done prior to the below.
14790 LPVOID release_me = aMonitor->union_value;
14791 bool is_method = aMonitor->is_method;
14792 if (mon_index < mCount) // An element other than the last is being removed. Shift the array to cover/delete it.
14793 memmove(aMonitor, aMonitor + 1, (mCount - mon_index) * sizeof(MsgMonitorStruct));
14794 if (is_method)
14795 free(release_me);
14796 else
14797 reinterpret_cast<IObject *>(release_me)->Release(); // Must be called last in case it calls a __delete() meta-function.
14798}
14799
14800
14801BOOL MsgMonitorList::IsMonitoring(UINT aMsg, UCHAR aMsgType)

Callers 1

BIF_DECLFunction · 0.45

Calls 1

ReleaseMethod · 0.45

Tested by

no test coverage detected