Commit 447b5fd
committed
Fix segfault when closing cursor/connection after Statement.free(). Fix #65.
When a Statement was freed (via context manager or explicit free()) before
its Cursor was closed, Cursor._clear() would attempt to close an already-
invalidated IResultSet, causing a segfault or DatabaseError.
Now checks whether the Statement's interface is still valid before closing
the result set. If the statement was already freed, the result set reference
is safely discarded instead.1 parent ea14774 commit 447b5fd
3 files changed
Lines changed: 34 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3965 | 3965 | | |
3966 | 3966 | | |
3967 | 3967 | | |
3968 | | - | |
| 3968 | + | |
| 3969 | + | |
| 3970 | + | |
| 3971 | + | |
| 3972 | + | |
| 3973 | + | |
| 3974 | + | |
3969 | 3975 | | |
3970 | 3976 | | |
3971 | 3977 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
0 commit comments