Index: trunk/BNC/src/bncephuser.cpp
===================================================================
--- trunk/BNC/src/bncephuser.cpp	(revision 6394)
+++ trunk/BNC/src/bncephuser.cpp	(revision 6395)
@@ -78,7 +78,8 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncEphUser::slotNewEphGPS(gpsephemeris gpseph) {
-  QMutexLocker locker(&_mutex);
-  t_ephGPS* eNew = new t_ephGPS(); eNew->set(&gpseph);
-  newEphHlp(eNew);
+  t_ephGPS* newEph = new t_ephGPS(); newEph->set(&gpseph);
+  if (putNewEph(newEph) != success) {
+    delete newEph;
+  }
 }
 
@@ -86,7 +87,8 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncEphUser::slotNewEphGlonass(glonassephemeris gloeph) {
-  QMutexLocker locker(&_mutex);
-  t_ephGlo* eNew = new t_ephGlo(); eNew->set(&gloeph);
-  newEphHlp(eNew);
+  t_ephGlo* newEph = new t_ephGlo(); newEph->set(&gloeph);
+  if (putNewEph(newEph) != success) {
+    delete newEph;
+  }
 }
 
@@ -94,7 +96,8 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncEphUser::slotNewEphGalileo(galileoephemeris galeph) {
-  QMutexLocker locker(&_mutex);
-  t_ephGal* eNew = new t_ephGal(); eNew->set(&galeph);
-  newEphHlp(eNew);
+  t_ephGal* newEph = new t_ephGal(); newEph->set(&galeph);
+  if (putNewEph(newEph) != success) {
+    delete newEph;
+  }
 }
 
@@ -102,27 +105,7 @@
 ////////////////////////////////////////////////////////////////////////////
 void bncEphUser::slotNewEphSBAS(sbasephemeris sbaseph) {
-  QMutexLocker locker(&_mutex);
-  t_ephSBAS* eNew = new t_ephSBAS(); eNew->set(&sbaseph);
-  newEphHlp(eNew);
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-void bncEphUser::newEphHlp(t_eph* eNew) {
-  QString prn(eNew->prn().toString().c_str());
-  if (_eph.contains(prn)) {
-    if (eNew->isNewerThan(_eph.value(prn)->last)) {
-      delete _eph.value(prn)->prev;
-      _eph.value(prn)->prev = _eph.value(prn)->last;
-      _eph.value(prn)->last = eNew;
-      ephBufferChanged();
-    }
-    else {
-      delete eNew;
-    }
-  }
-  else {
-    _eph.insert(prn, new t_ephPair(eNew));
-    ephBufferChanged();
+  t_ephSBAS* newEph = new t_ephSBAS(); newEph->set(&sbaseph);
+  if (putNewEph(newEph) != success) {
+    delete newEph;
   }
 }
@@ -131,21 +114,19 @@
 ////////////////////////////////////////////////////////////////////////////
 t_irc bncEphUser::putNewEph(t_eph* newEph) {
-
   QMutexLocker locker(&_mutex);
 
+  t_irc irc = failure;
+
   if (!newEph) {
-    return failure;
+    return irc;
   }
 
   QString prn(newEph->prn().toString().c_str());
-
-  t_irc irc = failure;
-
   if (_eph.contains(prn)) {
-    t_eph* eLast = _eph.value(prn)->last;
-    if (newEph->isNewerThan(eLast)) {
+    if (newEph->isNewerThan(_eph.value(prn)->last)) {
       delete _eph.value(prn)->prev;
       _eph.value(prn)->prev = _eph.value(prn)->last;
       _eph.value(prn)->last = newEph;
+      ephBufferChanged();
       irc = success;
     }
@@ -153,11 +134,9 @@
   else {
     _eph.insert(prn, new t_ephPair(newEph));
+    ephBufferChanged();
     irc = success;
   }
 
-  if (irc == success) {
-    ephBufferChanged();
-  }
+  return irc
+}
 
-  return irc;
-}
Index: trunk/BNC/src/bncephuser.h
===================================================================
--- trunk/BNC/src/bncephuser.h	(revision 6394)
+++ trunk/BNC/src/bncephuser.h	(revision 6395)
@@ -67,5 +67,5 @@
   }
 
-  t_irc putNewEph(t_eph* eph);
+  t_irc putNewEph(t_eph* newEph);
 
  public slots:
@@ -74,7 +74,4 @@
   void slotNewEphGalileo(galileoephemeris galeph);
   void slotNewEphSBAS(sbasephemeris sbaseph);
-
- private:
-  void newEphHlp(t_eph* eNew);
 
  protected:
