Commit 0a4b945
committed
[[ Bug 21928 ]] Fix memory leak when using menu buttons
This patch fixes a memory leak when using menu buttons caused by
failing to delete the internal stack created to enable them to
function. The leak came about when object deletion was being
abstracted, and the code was being refactored to use object handles.
The button's menu pointer was changed to an object handle and
the explicit deletion which was there previously removed. As
object handles are weak references, this meant that they were
never being deleted.
The leak has been fixed by ensuring that the dodel() method can
be run on menus-as-stacks (which required an extra check in the
MCStack::removereferences method) and then additionally adding
an explicit delete operator call on the button's menu-as-stack
in MCButton::freemenu().1 parent bbadbd7 commit 0a4b945
3 files changed
+24
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2860 | 2860 | | |
2861 | 2861 | | |
2862 | 2862 | | |
2863 | | - | |
2864 | | - | |
2865 | | - | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
2866 | 2871 | | |
2867 | | - | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
2868 | 2880 | | |
2869 | 2881 | | |
2870 | 2882 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1476 | 1476 | | |
1477 | 1477 | | |
1478 | 1478 | | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
1479 | 1486 | | |
1480 | 1487 | | |
1481 | 1488 | | |
| |||
0 commit comments