Skip to content

Commit 414e586

Browse files
committed
Regression fix for premature invalidation of object.
This corrects a regression which invalidates an information set object earlier than it should. This can lead to a segmentation fault in certain situations, as in effect `delete this` is called before it ought to be.
1 parent 0319f70 commit 414e586

2 files changed

Lines changed: 47 additions & 2 deletions

File tree

.github/workflows/python.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,52 @@ jobs:
3232
- name: Run tests
3333
run: pytest
3434

35+
macos-13:
36+
runs-on: macos-13
37+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
38+
strategy:
39+
matrix:
40+
python-version: ['3.12']
41+
42+
steps:
43+
- uses: actions/checkout@v4
44+
- name: Set up Python ${{ matrix.python-version }}
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: ${{ matrix.python-version }}
48+
- name: Set up dependencies
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install cython pytest wheel lxml numpy scipy
52+
- name: Build extension
53+
run: |
54+
python -m pip install -v .
55+
- name: Run tests
56+
run: pytest
57+
58+
macos-14:
59+
runs-on: macos-14
60+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
61+
strategy:
62+
matrix:
63+
python-version: ['3.12']
64+
65+
steps:
66+
- uses: actions/checkout@v4
67+
- name: Set up Python ${{ matrix.python-version }}
68+
uses: actions/setup-python@v5
69+
with:
70+
python-version: ${{ matrix.python-version }}
71+
- name: Set up dependencies
72+
run: |
73+
python -m pip install --upgrade pip
74+
pip install cython pytest wheel lxml numpy scipy
75+
- name: Build extension
76+
run: |
77+
python -m pip install -v .
78+
- name: Run tests
79+
run: pytest
80+
3581
windows:
3682
runs-on: windows-latest
3783
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name

src/games/gametree.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ void GameTreeActionRep::DeleteAction()
139139
member->children[where]->Invalidate();
140140
erase_atindex(member->children, where);
141141
}
142-
143142
if (m_infoset->IsChanceInfoset()) {
144143
m_infoset->m_efg->NormalizeChanceProbs(m_infoset);
145144
}
@@ -277,11 +276,11 @@ void GameTreeInfosetRep::RemoveMember(GameTreeNodeRep *p_node)
277276
if (m_members.empty()) {
278277
m_player->m_infosets.erase(
279278
std::find(m_player->m_infosets.begin(), m_player->m_infosets.end(), this));
280-
Invalidate();
281279
int iset = 1;
282280
for (auto &infoset : m_player->m_infosets) {
283281
infoset->m_number = iset++;
284282
}
283+
Invalidate();
285284
}
286285
}
287286

0 commit comments

Comments
 (0)