File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ numvar(m::SCIPMathProgModel) = _getNumVars(m)
18
18
" The number of proper constraints, excluding those from lazy callbacks."
19
19
numconstr (m:: SCIPMathProgModel ) = _getNumConss (m)
20
20
21
- freemodel! (m:: SCIPMathProgModel ) = error (" Not implemented for SCIP.jl!" )
21
+ function freemodel! (m:: SCIPMathProgModel )
22
+ # call finalizer directly
23
+ freescip (m. inner)
24
+ end
22
25
23
26
# TODO : mapping for :SemiCont, :SemiInt
24
27
const vartypemap = Dict {Symbol, Cint} (
Original file line number Diff line number Diff line change @@ -21,8 +21,13 @@ type SCIPModel
21
21
end
22
22
23
23
function freescip (m:: SCIPModel )
24
- @assert m. ptr_model != C_NULL
25
- _freeModel (m)
24
+ # avoid double free
25
+ if m. ptr_model != C_NULL
26
+ _freeModel (m)
27
+ m. ptr_model = C_NULL
28
+ else
29
+ Base. warn_once (" Tried to free already freed model, ignoring." )
30
+ end
26
31
end
27
32
28
33
# Linear Quadratic Model
You can’t perform that action at this time.
0 commit comments