Mercurial > octave
comparison libinterp/dldfcn/symbfact.cc @ 27940:ec0690a6955c stable rc-5-1-90
Lock amd and symbfact to avoid segmentation fault with SuiteSparse (bug #57435).
* dldfcn/amd.cc (Famd), dldfcn/symbfact.cc (Fsymbfact): Use DEFMETHOD_DLD. Call
"mlock" to avoid having invalid function pointers in global SuiteSparse_config
structure when the functions are unloaded (e.g. with "clear functions").
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 22 Dec 2019 01:01:27 +0100 |
parents | d0a061e6d70f |
children | b442ec6dda5c |
comparison
equal
deleted
inserted
replaced
27868:56dd7419d7aa | 27940:ec0690a6955c |
---|---|
41 | 41 |
42 #include "defun-dld.h" | 42 #include "defun-dld.h" |
43 #include "error.h" | 43 #include "error.h" |
44 #include "errwarn.h" | 44 #include "errwarn.h" |
45 #include "ovl.h" | 45 #include "ovl.h" |
46 #include "parse.h" | |
46 #include "utils.h" | 47 #include "utils.h" |
47 | 48 |
48 DEFUN_DLD (symbfact, args, nargout, | 49 DEFMETHOD_DLD (symbfact, interp, args, nargout, |
49 doc: /* -*- texinfo -*- | 50 doc: /* -*- texinfo -*- |
50 @deftypefn {} {[@var{count}, @var{h}, @var{parent}, @var{post}, @var{R}] =} symbfact (@var{S}) | 51 @deftypefn {} {[@var{count}, @var{h}, @var{parent}, @var{post}, @var{R}] =} symbfact (@var{S}) |
51 @deftypefnx {} {[@dots{}] =} symbfact (@var{S}, @var{typ}) | 52 @deftypefnx {} {[@dots{}] =} symbfact (@var{S}, @var{typ}) |
52 @deftypefnx {} {[@dots{}] =} symbfact (@var{S}, @var{typ}, @var{mode}) | 53 @deftypefnx {} {[@dots{}] =} symbfact (@var{S}, @var{typ}, @var{mode}) |
53 | 54 |
54 Perform a symbolic factorization analysis of the sparse matrix @var{S}. | 55 Perform a symbolic factorization analysis of the sparse matrix @var{S}. |
207 | 208 |
208 cholmod_common Common; | 209 cholmod_common Common; |
209 cholmod_common *cm = &Common; | 210 cholmod_common *cm = &Common; |
210 CHOLMOD_NAME(start) (cm); | 211 CHOLMOD_NAME(start) (cm); |
211 | 212 |
213 // Lock the function to not loose the SuiteSparse_config structure | |
214 interp.mlock (); | |
215 | |
212 double spu = octave_sparse_params::get_key ("spumoni"); | 216 double spu = octave_sparse_params::get_key ("spumoni"); |
213 if (spu == 0.0) | 217 if (spu == 0.0) |
214 { | 218 { |
215 cm->print = -1; | 219 cm->print = -1; |
216 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, nullptr); | 220 SUITESPARSE_ASSIGN_FPTR (printf_func, cm->print_function, nullptr); |