Try to be more careful when loading FrameInfos from disk.
authorCarl Hetherington <cth@carlh.net>
Thu, 25 Jul 2013 15:21:51 +0000 (16:21 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 25 Jul 2013 15:21:51 +0000 (16:21 +0100)
src/lib/job.h
src/lib/writer.cc
src/wx/job_manager_view.cc

index eb09ba386509cf33398fe6628c67ca863ff0ca78..9b8b14a93a2efc434b70297b9a2dbd51773e895a 100644 (file)
@@ -70,6 +70,9 @@ public:
        void ascend ();
        void descend (float);
        float overall_progress () const;
+       bool progress_unknown () const {
+               return _progress_unknown;
+       }
 
        boost::signals2::signal<void()> Progress;
        /** Emitted from the UI thread when the job is finished */
index 522ecc1c1d7a94265b1e296476bdbfb1f0f6f8c8..4c8a36597e56667bbbd0ff55c84211b4cf000e57 100644 (file)
@@ -411,6 +411,10 @@ Writer::check_existing_picture_mxf_frame (FILE* mxf, int f, Eyes eyes)
        /* Read the frame info as written */
        ifstream ifi (_film->info_path (f, eyes).c_str());
        libdcp::FrameInfo info (ifi);
+       if (info.size == 0) {
+               _film->log()->log (String::compose ("Existing frame %1 has no info file", f));
+               return false;
+       }
        
        /* Read the data from the MXF and hash it */
        fseek (mxf, info.offset, SEEK_SET);
index 20f885a9b284cf7b8b0b12256413bf1ea3f618f3..b627edc2f31be8b7cc20b71a503bf90765f35787 100644 (file)
@@ -43,7 +43,6 @@ public:
                , _window (window)
                , _panel (panel)
                , _table (table)
-               , _needs_pulse (false)
        {
                int n = 0;
                
@@ -86,11 +85,9 @@ public:
 
        void maybe_pulse ()
        {
-               if (_job->running() && _needs_pulse) {
+               if (_job->running() && _job->progress_unknown ()) {
                        _gauge->Pulse ();
                }
-
-               _needs_pulse = true;
        }
 
 private:
@@ -101,7 +98,6 @@ private:
                if (p >= 0) {
                        checked_set (_message, _job->status ());
                        _gauge->SetValue (p * 100);
-                       _needs_pulse = false;
                }
 
                _table->Layout ();
@@ -156,7 +152,6 @@ private:
        wxButton* _cancel;
        wxButton* _pause;
        wxButton* _details;
-       bool _needs_pulse;
 };
 
 /** Must be called in the GUI thread */