Author Topic: Core: MIR_APP_DLL(int) Srmm_RemoveButton(BBButton *bbdi) is broken  (Read 961 times)

0 Members and 1 Guest are viewing this topic.

Offline hydrogen fluoride

Original code:

MIR_APP_DLL(int) Srmm_RemoveButton(BBButton *bbdi)
{
    if (!bbdi)
        return 1;
    CustomButtonData *pFound = nullptr;
   {
        mir_cslock lck(csToolBar);
        for (auto &cbd : arButtonsList.rev_iter())
            if (!mir_strcmp(cbd->m_pszModuleName, bbdi->pszModuleName) && cbd->m_dwButtonID == bbdi->dwButtonID)
                pFound = arButtonsList.removeItem(&cbd);
   }
    if (pFound)
    {
        CSrmmToolbarOptions::RereadButtons();
        WindowList_Broadcast(g_hWindowList, WM_CBD_REMOVED, pFound->m_dwButtonCID, (LPARAM)pFound);
        delete pFound;
    }
    return 0;
}

In my opinion this is not needed. We should not clear memory from buttons while program works.
Meenwhile there is sets of buttons, not an solo buttons.
Also there is build-in Windows instruments to manage GUI elements.

« Last Edit: 29 10 2022, 22:28:16 by hydrogen fluoride »