)]}'
{
  "commit": "464b2740c4d8cc5ddf995de8d79cf42a052125af",
  "tree": "82e4c84917fdd552fded1b983eb91dacd9c03eb1",
  "parents": [
    "97a1cdea52b15c997312dfec47f6020d558d0171"
  ],
  "author": {
    "name": "luigi-rosso",
    "email": "hello@rive.app",
    "time": "Thu Nov 09 17:57:18 2023 +0000"
  },
  "committer": {
    "name": "luigi-rosso",
    "email": "hello@rive.app",
    "time": "Thu Nov 09 17:57:18 2023 +0000"
  },
  "message": "Delete assets after artboards to fix race condition with FileAssetReferencers.\n\nI caught a random crash in Unity. Our unreferencing logic has a race condition! This is probably causing crashes in a lot of the runtimes, randomly.\n\nWe attempt to unregister a file asset referencer when the FileAssetReferencer is destructed here:\nhttps://github.com/rive-app/rive/blob/d708e6a07b454ce0fc20d9432172f2b58c9f29f7/packages/runtime/src/assets/file_asset_referencer.cpp#L10-L13\n\nThis causes invalid memory access if m_fileAsset has already been deleted. This can happen when the source artboards stored in a file get deleted. Doesn\u0027t affect instances, but any-time a whole File is destructed this race condition can occur. We store our artboards and file assets as lists in our File object. Because they are stored in vectors as unique ptrs, we aren\u0027t guaranteed destructor order (some compilers will destruct the list of artboards first and some will destruct the files first). I\u0027ve seen Clang do both (in Windows it was destroying the assets first which causes the problem as the references in the artboard then try to access the file assets).\n\nWe should be really cautious when accessing bare pointers in destructors and make sure we understand the lifecycle of any objects we\u0027re referencing during destruction.\n\nFor now this is the cleanest immediate fix, ensure that destruction is done in order:\n1. Artboards and their components first\n2. File assets\n3. Backboard\n\nWe introduced this here: https://github.com/rive-app/rive/pull/6068\n\nDiffs\u003d\n18ae32102 Delete assets after artboards to fix race condition with FileAssetReferencers. (#6223)\n\nCo-authored-by: Luigi Rosso \u003cluigi-rosso@users.noreply.github.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9266ff894a21a0851cb0c453caa854e6765b19f8",
      "old_mode": 33188,
      "old_path": ".rive_head",
      "new_id": "a5ecfc8142b0cdc02d777cc34c71dfc9f13dc342",
      "new_mode": 33188,
      "new_path": ".rive_head"
    },
    {
      "type": "modify",
      "old_id": "8091299dd9bb6e81df08f9e5b972f53881b70fe8",
      "old_mode": 33188,
      "old_path": "include/rive/assets/file_asset.hpp",
      "new_id": "f1d587b98b5bec6f9a7c58a202f5235c0ab7520c",
      "new_mode": 33188,
      "new_path": "include/rive/assets/file_asset.hpp"
    },
    {
      "type": "modify",
      "old_id": "b1b75b57ba05efb66ea6964e440281ead1f38e73",
      "old_mode": 33188,
      "old_path": "include/rive/file.hpp",
      "new_id": "9f6659d9304856f6562dbc0bb49a6c3ed5cc9860",
      "new_mode": 33188,
      "new_path": "include/rive/file.hpp"
    },
    {
      "type": "modify",
      "old_id": "6c3fee2f97c7b659391de920301ee180ca24da00",
      "old_mode": 33188,
      "old_path": "src/assets/file_asset_referencer.cpp",
      "new_id": "11b7996e20d13f450b37932273b17a77e749e8ac",
      "new_mode": 33188,
      "new_path": "src/assets/file_asset_referencer.cpp"
    },
    {
      "type": "modify",
      "old_id": "cf77acbcbd183f3848fd7d79c3e1c02067c9e000",
      "old_mode": 33188,
      "old_path": "src/file.cpp",
      "new_id": "a6dee57cbad20353464b5de71d16410e52735ceb",
      "new_mode": 33188,
      "new_path": "src/file.cpp"
    }
  ]
}
