[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdenlive/next] src: Fix crashes caused by locale issue, for example in movit whitebalance
From:       Vincent PINON <vincent.pinon () laposte ! net>
Date:       2014-04-30 20:27:58
Message-ID: E1Wfb6k-0003AX-Ev () scm ! kde ! org
[Download RAW message or body]

Git commit d1e8d53d110243c284406578f65657d7d404717f by Vincent PINON, on behalf of \
Jean-Baptiste Mardelle. Committed on 02/04/2014 at 11:16.
Pushed by vpinon into branch 'next'.

Fix crashes caused by locale issue, for example in movit whitebalance

M  +1    -0    src/beziercurve/cubicbezierspline.cpp
M  +8    -0    src/clipitem.cpp
M  +1    -0    src/clipproperties.cpp
M  +5    -0    src/customtrackview.cpp
M  +1    -0    src/kis_cubic_curve.cpp
M  +1    -0    src/profilesdialog.cpp
M  +1    -0    src/projectsettings.cpp
M  +4    -0    src/renderer.cpp
M  +2    -0    src/scopes/colorscopes/vectorscope.cpp
M  +1    -0    src/stopmotion/stopmotion.cpp
M  +1    -0    src/timecode.cpp
M  +6    -2    src/trackview.cpp

http://commits.kde.org/kdenlive/d1e8d53d110243c284406578f65657d7d404717f

diff --git a/src/beziercurve/cubicbezierspline.cpp \
b/src/beziercurve/cubicbezierspline.cpp index c912c8b..cd14dae 100644
--- a/src/beziercurve/cubicbezierspline.cpp
+++ b/src/beziercurve/cubicbezierspline.cpp
@@ -70,6 +70,7 @@ QString CubicBezierSpline::toString() const
 {
     QStringList spline;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     foreach(const BPoint &p, m_points) {
         spline << QString::fromLatin1("%1;%2#%3;%4#%5;%6").arg(locale.toString(p.h1.x())).arg(locale.toString(p.h1.y()))
                
                                               \
                .arg(locale.toString(p.p.x())).arg(locale.toString(p.p.y()))
diff --git a/src/clipitem.cpp b/src/clipitem.cpp
index a27d280..fc40c10 100644
--- a/src/clipitem.cpp
+++ b/src/clipitem.cpp
@@ -352,6 +352,7 @@ bool ClipItem::checkKeyFrames(int width, int height, int \
previousDuration, int c  {
     bool clipEffectsModified = false;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     // go through all effects this clip has
     for (int ix = 0; ix < m_effectList.count(); ++ix) {
         // Check geometry params
@@ -429,6 +430,7 @@ void ClipItem::setKeyframes(const int ix, const QStringList \
&keyframes)  QDomElement effect = m_effectList.at(ix);
     if (effect.attribute("disable") == "1") return;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     QDomNodeList params = effect.elementsByTagName("parameter");
     int keyframeParams = 0;
     for (int i = 0; i < params.count(); ++i) {
@@ -465,6 +467,7 @@ void ClipItem::setSelectedEffect(const int ix)
 {
     m_selectedEffect = ix;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     QDomElement effect = effectAtIndex(m_selectedEffect);
     if (!effect.isNull() && effect.attribute("disable") != "1") {
         QDomNodeList params = effect.elementsByTagName("parameter");
@@ -1551,6 +1554,7 @@ EffectsParameterList ClipItem::addEffect(QDomElement effect, \
bool /*animate*/)  {
     bool needRepaint = false;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     int ix;
     QDomElement insertedEffect;
     if (!effect.hasAttribute("kdenlive_ix")) {
@@ -1884,6 +1888,7 @@ void ClipItem::insertKeyframe(QDomElement effect, int pos, int \
val)  {
     if (effect.attribute("disable") == "1") return;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     effect.setAttribute("active_keyframe", pos);
     m_editedKeyframe = pos;
     QDomNodeList params = effect.elementsByTagName("parameter");
@@ -1923,6 +1928,7 @@ void ClipItem::movedKeyframe(QDomElement effect, int oldpos, \
int newpos, double  {
     if (effect.attribute("disable") == "1") return;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     effect.setAttribute("active_keyframe", newpos);
     QDomNodeList params = effect.elementsByTagName("parameter");
     int start = cropStart().frames(m_fps);
@@ -1957,6 +1963,7 @@ void ClipItem::updateKeyframes(QDomElement effect)
 {
     m_keyframes.clear();
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     // parse keyframes
     QDomNodeList params = effect.elementsByTagName("parameter");
     QDomElement e = params.item(m_visibleParam).toElement();
@@ -2074,6 +2081,7 @@ bool ClipItem::updateNormalKeyframes(QDomElement parameter, \
ItemInfo oldInfo)  int out = (cropStart() + cropDuration()).frames(m_fps) - 1;
     int oldin = oldInfo.cropStart.frames(m_fps);
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     bool keyFrameUpdated = false;
 
     const QStringList data = parameter.attribute("keyframes").split(';', \
                QString::SkipEmptyParts);
diff --git a/src/clipproperties.cpp b/src/clipproperties.cpp
index 0598489..96168dd 100644
--- a/src/clipproperties.cpp
+++ b/src/clipproperties.cpp
@@ -956,6 +956,7 @@ QMap <QString, QString> ClipProperties::properties()
 {
     QMap <QString, QString> props;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     ClipType t = Unknown;
     if (m_clip != NULL) {
         t = m_clip->clipType();
diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp
index 6774090..6c24857 100644
--- a/src/customtrackview.cpp
+++ b/src/customtrackview.cpp
@@ -1897,6 +1897,7 @@ void CustomTrackView::addEffect(int track, GenTime pos, \
QDomElement effect)  return;
             }
             QLocale locale;
+            locale.setNumberOptions(QLocale::OmitGroupSeparator);
             double speed = locale.toDouble(EffectsList::parameter(effect, "speed")) \
                / 100.0;
             int strobe = EffectsList::parameter(effect, "strobe").toInt();
             if (strobe == 0) strobe = 1;
@@ -2235,6 +2236,7 @@ void CustomTrackView::updateEffect(int track, GenTime pos, \
                QDomElement insertedE
                 doChangeClipSpeed(clip->info(), clip->speedIndependantInfo(), 1.0, \
clip->speed(), 1, clip->baseClip()->getId());  } else {
                 QLocale locale;
+                locale.setNumberOptions(QLocale::OmitGroupSeparator);
                 double speed = locale.toDouble(EffectsList::parameter(effect, \
                "speed")) / 100.0;
                 int strobe = EffectsList::parameter(effect, "strobe").toInt();
                 if (strobe == 0) strobe = 1;
@@ -6272,6 +6274,7 @@ void CustomTrackView::adjustKeyfames(GenTime oldstart, GenTime \
newstart, GenTime  int diff = (newstart - oldstart).frames(m_document->fps());
     int max = (newstart + duration).frames(m_document->fps());
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     QDomNodeList params = xml.elementsByTagName("parameter");
     for (int i = 0; i < params.count(); ++i) {
         QDomElement e = params.item(i).toElement();
@@ -7577,6 +7580,7 @@ EffectsParameterList CustomTrackView::getEffectArgs(const \
QDomElement &effect)  {
     EffectsParameterList parameters;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     parameters.addParam("tag", effect.attribute("tag"));
     //if (effect.hasAttribute("region")) parameters.addParam("region", \
effect.attribute("region"));  parameters.addParam("kdenlive_ix", \
effect.attribute("kdenlive_ix")); @@ -7609,6 +7613,7 @@ EffectsParameterList \
CustomTrackView::getEffectArgs(const QDomElement &effect)  void \
CustomTrackView::adjustEffectParameters(EffectsParameterList &parameters, \
QDomNodeList params, MltVideoProfile profile, const QString &prefix)  {
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     for (int i = 0; i < params.count(); ++i) {
         QDomElement e = params.item(i).toElement();
         QString paramname = prefix + e.attribute("name");
diff --git a/src/kis_cubic_curve.cpp b/src/kis_cubic_curve.cpp
index 128cde9..6cd847d 100644
--- a/src/kis_cubic_curve.cpp
+++ b/src/kis_cubic_curve.cpp
@@ -405,6 +405,7 @@ QString KisCubicCurve::toString() const
 {
     QString sCurve;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     foreach(const QPointF & pair, d->data->points) {
         sCurve += locale.toString(pair.x());
         sCurve += '/';
diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp
index 3b2d72e..07545f9 100644
--- a/src/profilesdialog.cpp
+++ b/src/profilesdialog.cpp
@@ -570,6 +570,7 @@ void ProfilesDialog::slotUpdateDisplay(QString currentProfile)
         return;
     }
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     m_selectedProfileIndex = m_view.profiles_list->currentIndex();
     if (currentProfile.isEmpty())
         currentProfile = \
                m_view.profiles_list->itemData(m_view.profiles_list->currentIndex()).toString();
                
diff --git a/src/projectsettings.cpp b/src/projectsettings.cpp
index 848a071..3126deb 100644
--- a/src/projectsettings.cpp
+++ b/src/projectsettings.cpp
@@ -392,6 +392,7 @@ void ProjectSettings::accept()
 void ProjectSettings::slotUpdateDisplay()
 {
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     QString currentProfile = \
                profiles_list->itemData(profiles_list->currentIndex()).toString();
     QMap< QString, QString > values = \
                ProfilesDialog::getSettingsFromFile(currentProfile);
     p_size->setText(values.value("width") + 'x' + values.value("height"));
diff --git a/src/renderer.cpp b/src/renderer.cpp
index c85cdd4..45d14d2 100644
--- a/src/renderer.cpp
+++ b/src/renderer.cpp
@@ -728,6 +728,7 @@ void Render::processFileProperties()
 {
     requestClipInfo info;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     while (!m_requestList.isEmpty()) {
         m_infoMutex.lock();
         info = m_requestList.takeFirst();
@@ -1360,6 +1361,7 @@ int Render::setSceneList(QString playlist, int position)
 
     blockSignals(true);
     m_locale = QLocale();
+    m_locale.setNumberOptions(QLocale::OmitGroupSeparator);
     m_mltProducer = new Mlt::Producer(*m_mltProfile, "xml-string", \
playlist.toUtf8().constData());  if (!m_mltProducer || !m_mltProducer->is_valid()) {
         kDebug() << " WARNING - - - - -INVALID PLAYLIST: " << \
playlist.toUtf8().constData(); @@ -2049,6 +2051,7 @@ Mlt::Producer \
*Render::checkSlowMotionProducer(Mlt::Producer *prod, QDomElement  {
     if (element.attribute("speed", "1.0").toDouble() == 1.0 && \
element.attribute("strobe", "1").toInt() == 1) return prod;  QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     // We want a slowmotion producer
     double speed = element.attribute("speed", "1.0").toDouble();
     int strobe = element.attribute("strobe", "1").toInt();
@@ -3077,6 +3080,7 @@ bool Render::mltEditEffect(int track, const GenTime &position, \
EffectsParameterL  if (position < GenTime()) {
         return mltEditTrackEffect(track, params);
     }
+    
     // find filter
     Mlt::Service service(m_mltProducer->parent().get_service());
     Mlt::Tractor tractor(service);
diff --git a/src/scopes/colorscopes/vectorscope.cpp \
b/src/scopes/colorscopes/vectorscope.cpp index 49632a5..906aae6 100644
--- a/src/scopes/colorscopes/vectorscope.cpp
+++ b/src/scopes/colorscopes/vectorscope.cpp
@@ -216,6 +216,7 @@ QImage Vectorscope::renderHUD(uint)
 
     QImage hud;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     if (m_mouseWithinWidget) {
         // Mouse moved: Draw a circle over the scope
 
@@ -506,6 +507,7 @@ QImage Vectorscope::renderBackground(uint)
 void Vectorscope::slotGainChanged(int newval)
 {
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     m_gain = 1 + (float)newval/10;
     ui->lblGain->setText(locale.toString(m_gain, 'f', 1) + 'x');
     forceUpdateScope();
diff --git a/src/stopmotion/stopmotion.cpp b/src/stopmotion/stopmotion.cpp
index 120e208..9255e07 100644
--- a/src/stopmotion/stopmotion.cpp
+++ b/src/stopmotion/stopmotion.cpp
@@ -462,6 +462,7 @@ void StopmotionWidget::slotLive(bool isOn)
         m_frame_preview->setHidden(true);
         m_monitor->videoBox->setHidden(false);
         QLocale locale;
+        locale.setNumberOptions(QLocale::OmitGroupSeparator);
 
         MltVideoProfile profile;
         QString resource;
diff --git a/src/timecode.cpp b/src/timecode.cpp
index d36b0f2..4dc09ba 100644
--- a/src/timecode.cpp
+++ b/src/timecode.cpp
@@ -381,6 +381,7 @@ const QString Timecode::getTimecodeFrames(const GenTime & time) \
const  const QString Timecode::getTimecodeSeconds(const GenTime & time) const
 {
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     return locale.toString(time.seconds());
 }
 
diff --git a/src/trackview.cpp b/src/trackview.cpp
index 6209421..a484b86 100644
--- a/src/trackview.cpp
+++ b/src/trackview.cpp
@@ -353,7 +353,8 @@ void TrackView::parseDocument(const QDomDocument &doc)
             }
 
             QDomElement base = MainWindow::transitions.getEffectByTag(mlt_service, \
                transitionId).cloneNode().toElement();
-
+            QLocale locale;
+            locale.setNumberOptions(QLocale::OmitGroupSeparator);
             if (!base.isNull()) for (int k = 0; k < transitionparams.count(); k++) {
                 p = transitionparams.item(k).toElement();
                 if (!p.isNull()) {
@@ -374,7 +375,7 @@ void TrackView::parseDocument(const QDomDocument &doc)
                                     } else {
                                         fact = factor.toDouble();
                                     }
-                                    paramValue = QLocale().toString(offset + \
paramValue.toDouble() * fact); +                                    paramValue = \
locale.toString(offset + paramValue.toDouble() * fact);  }
                             }
                             e.setAttribute("value", paramValue);
@@ -629,6 +630,7 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool \
locked, const Q  int strobe = 1;
             if (idString.startsWith("slowmotion")) {
                 QLocale locale;
+                locale.setNumberOptions(QLocale::OmitGroupSeparator);
                 id = idString.section(':', 1, 1);
                 speed = locale.toDouble(idString.section(':', 2, 2));
                 strobe = idString.section(':', 3, 3).toInt();
@@ -772,6 +774,7 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, \
QDomElement parentNo  {
     int effectNb = 0;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     for (int ix = 0; ix < effects.count(); ix++) {
         bool disableeffect = false;
         QDomElement effect = effects.at(ix).toElement();
@@ -963,6 +966,7 @@ void TrackView::adjustparameterValue(QDomNodeList \
clipeffectparams, const QStrin  {
     QDomElement e;
     QLocale locale;
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
     for (int k = 0; k < clipeffectparams.count(); k++) {
         e = clipeffectparams.item(k).toElement();
         if (!e.isNull() && e.tagName() == "parameter" && e.attribute("name") == \
paramname) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic