Changeset ead0c22 in git for src/gfxcore.cc


Ignore:
Timestamp:
04/07/19 02:59:12 (3 months ago)
Author:
Olly Betts <olly@…>
Branches:
master
Children:
127435f
Parents:
fa0f804
Message:

Avoid undefined function pointer casts

We were casting a function pointer with a bool return type to the
same type but with a void return type. In practice this probably
works fine on most platforms, but it's undefined behaviour and
also gives a compiler warning with some compilers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gfxcore.cc

    rfa0f804 read0c22  
    42554255         * circle. */
    42564256        menu.AppendCheckItem(menu_CTL_DEGREES, wmsg(/*&Degrees*/343));
    4257         menu.Connect(wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)&wxEvtHandler::ProcessEvent, NULL, m_Parent->GetEventHandler());
     4257        menu.Bind(wxEVT_COMMAND_MENU_SELECTED,
     4258                  [&](wxEvent& e) {
     4259                      m_Parent->GetEventHandler()->ProcessEvent(e);
     4260                  });
    42584261        PopupMenu(&menu);
    42594262        return true;
     
    42784281         * degrees = 50 grad). */
    42794282        menu.AppendCheckItem(menu_CTL_PERCENT, wmsg(/*&Percent*/430));
    4280         menu.Connect(wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)&wxEvtHandler::ProcessEvent, NULL, m_Parent->GetEventHandler());
     4283        menu.Bind(wxEVT_COMMAND_MENU_SELECTED,
     4284                  [&](wxEvent& e) {
     4285                      m_Parent->GetEventHandler()->ProcessEvent(e);
     4286                  });
    42814287        PopupMenu(&menu);
    42824288        return true;
     
    42934299         */
    42944300        menu.AppendCheckItem(menu_CTL_METRIC, wmsg(/*&Metric*/342));
    4295         menu.Connect(wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)&wxEvtHandler::ProcessEvent, NULL, m_Parent->GetEventHandler());
     4301        menu.Bind(wxEVT_COMMAND_MENU_SELECTED,
     4302                  [&](wxEvent& e) {
     4303                      m_Parent->GetEventHandler()->ProcessEvent(e);
     4304                  });
    42964305        PopupMenu(&menu);
    42974306        return true;
     
    43164325        else if (m_ColourBy == COLOUR_BY_GRADIENT)
    43174326            menu.AppendCheckItem(menu_CTL_DEGREES, wmsg(/*&Degrees*/343));
    4318         menu.Connect(wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)&wxEvtHandler::ProcessEvent, NULL, m_Parent->GetEventHandler());
     4327        menu.Bind(wxEVT_COMMAND_MENU_SELECTED,
     4328                  [&](wxEvent& e) {
     4329                      m_Parent->GetEventHandler()->ProcessEvent(e);
     4330                  });
    43194331        PopupMenu(&menu);
    43204332        return true;
Note: See TracChangeset for help on using the changeset viewer.