Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace every use of the foreach macro with a C++11 range-based for loop #2669

Merged
merged 3 commits into from
Mar 14, 2016

Commits on Mar 13, 2016

  1. Make lb302 include math.h so we can switch it to C++11

    M_PI is no longer defined by default in C++11, but lb302.cpp needs it.
    Therefore, before switching to C++11, we add an include.
    Fastigium committed Mar 13, 2016
    Configuration menu
    Copy the full SHA
    bfa83da View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ac67f2a View commit details
    Browse the repository at this point in the history
  3. Replace every use of the foreach macro with a C++11 range-based for loop

    This prevents a race condition with Qt5. A foreach loop makes a copy of its
    Qt container, increasing the reference count to the container's internal
    data. Qt5 often asserts isDetached(), which requires the reference count to
    be <= 1. This assertion fails when the foreach loop increases the reference
    count at exactly the wrong moment. Using a range-based for loop prevents an
    unnecessary copy from being made and ensures this race condition isn't
    triggered.
    Fastigium committed Mar 13, 2016
    Configuration menu
    Copy the full SHA
    3c7bfba View commit details
    Browse the repository at this point in the history