boostorg / boostorg/python

boost::python handle& operator=() is not implemented correctly

未關閉
#190 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C++
星號
537
分支
223
平均合併
11 小時 22 分鐘
30 天內合併 PR
2

描述

The assignment operator for a handle is implemented by first decreasing the reference count of the contained object and then incrementing the one of the right hand side.

```python
python::xdecref(m_p);
m_p = python::xincref(r.m_p);
```

This is not the correct order but should be the other way round, i.e. first incrementing than decrementing. This is also the effect described in the documentation.

```python
python::xincref(r.m_p)
python::xdecref(m_p);
m_p = r.m_p
```

By doing it the current way, self assignment increases the reference count of a potentially already freed object.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。