academic/scidavis: Patched to fix crashes.

Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
This commit is contained in:
Fellype do Nascimento 2017-11-29 17:28:58 +00:00 committed by Willy Sudiarto Raharjo
parent 20970278af
commit b285d0650e
3 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,28 @@
diff --git a/libscidavis/src/Integration.cpp b/libscidavis/src/Integration.cpp
index b9cb786..0b22272 100644
--- a/libscidavis/src/Integration.cpp
+++ b/libscidavis/src/Integration.cpp
@@ -135,17 +135,17 @@ QString Integration::logInfo()
throw runtime_error("invalid method");
}
- gsl_interp *interpolation = gsl_interp_alloc(method_t, d_n);
- gsl_interp_init(interpolation, d_x, d_y, d_n);
-
- if (d_n < gsl_interp_min_size(interpolation))
+ if (d_n < gsl_interp_type_min_size(method_t))
{
QMessageBox::critical((ApplicationWindow *)parent(), tr("SciDAVis") + " - " + tr("Error"),
- tr("You need at least %1 points in order to perform this operation!").arg(gsl_interp_min_size(interpolation)));
+ tr("You need at least %1 points in order to perform this operation!").arg(gsl_interp_type_min_size(method_t)));
d_init_err = true;
- return "";
+ return QString("");
}
+ gsl_interp *interpolation = gsl_interp_alloc(method_t, d_n);
+ gsl_interp_init(interpolation, d_x, d_y, d_n);
+
QString logInfo = "[" + QDateTime::currentDateTime().toString(Qt::LocalDate) + "\t" + tr("Plot")+ ": ''" + d_graph->parentPlotName() + "'']\n";
logInfo += "\n" + tr("Numerical integration of") + ": " + d_curve->title().text() + tr(" using ") + method_name + tr("Interpolation") + "\n";

View File

@ -0,0 +1,20 @@
diff --git a/libscidavis/src/PythonScript.cpp b/libscidavis/src/PythonScript.cpp
index 27d4eec..a8b8ac2 100644
--- a/libscidavis/src/PythonScript.cpp
+++ b/libscidavis/src/PythonScript.cpp
@@ -43,6 +43,7 @@ PythonScript::PythonScript(PythonScripting *env, const QString &code, QObject *c
: Script(env, code, context, name)
{
PyCode = NULL;
+ PyGILState_STATE state = PyGILState_Ensure();
// Old: All scripts share a global namespace, and module top-level has its own nonstandard local namespace
modLocalDict = PyDict_New();
// A bit of a hack, but we need either IndexError or len() from __builtins__.
@@ -71,6 +72,7 @@ PythonScript::PythonScript(PythonScripting *env, const QString &code, QObject *c
else
PyErr_Print();
// "self" is unique to each script, so they can't all run in the __main__ namespace
+ PyGILState_Release(state);
setQObject(Context, "self");
}

View File

@ -25,7 +25,7 @@
PRGNAM=scidavis
VERSION=${VERSION:-1.22}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -71,6 +71,14 @@ sed -i -e 's#share/man/man1/scidavis.1#man/man1#' scidavis/scidavis.pro
# Correction needed in order to find qwtplot3d in its default path
grep -rl "qwtplot3d/" libscidavis/src/ | xargs sed -i "s:<qwtplot3d/:<:"
# Patch to fix crashes using integration in python scripts
# See https://sourceforge.net/p/scidavis/scidavis-bugs/320/
patch -p1 < $CWD/integration_with_python_crash_bug_320.patch libscidavis/src/PythonScript.cpp
# Patch to fix crashes when integration is performed with less points than required by interpolation method
# See https://sourceforge.net/p/scidavis/scidavis-bugs/321/
patch -p1 < $CWD/crash_integration_with_too_few_points_bug_321.patch libscidavis/src/Integration.cpp
## For some unknown reason, to build in Slackware we need to run qmake twice in order to get the app icons working properly
## See https://sourceforge.net/p/scidavis/scidavis-bugs/259/
qmake