fix segv in formattools for record format ffmpeg
authorGood Guy <good1.2guy@gmail.com>
Sun, 27 Sep 2015 18:48:25 +0000 (12:48 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sun, 27 Sep 2015 18:48:25 +0000 (12:48 -0600)
cinelerra-5.0/cinelerra/assetedit.C
cinelerra-5.0/cinelerra/assetedit.h
cinelerra-5.0/cinelerra/formattools.C
cinelerra-5.0/guicast/thread.h

index c7ef9f24e8755e62e090172fe514f021233b95fb..5422d97eef2c77cc954b099022010a3f34746457 100644 (file)
@@ -796,9 +796,14 @@ DetailAssetThread::DetailAssetThread(MWindow *mwindow)
 }
 
 DetailAssetThread::~DetailAssetThread()
+{
+       stop();
+}
+
+void DetailAssetThread::stop()
 {
        if( Thread::running() ) {
-               dwindow->lock_window("DetailAssetThread::~DetailAssetThread");
+               dwindow->lock_window("DetailAssetThread::stop");
                dwindow->set_done(1);
                dwindow->unlock_window();
                Thread::join();
@@ -831,11 +836,10 @@ void DetailAssetWindow::create_objects()
 
 void DetailAssetThread::start(Asset *asset)
 {
-       if( !Thread::running() ) {
-               delete dwindow;
-               dwindow = new DetailAssetWindow(mwindow, asset);
-               Thread::start();
-       }
+       stop();
+       delete dwindow;
+       dwindow = new DetailAssetWindow(mwindow, asset);
+       Thread::start();
 }
 
 void DetailAssetThread::run()
index 06f72e79fc03a70944ae6c21ca64aaa29c1c139c..32199f060639ad25ae4dcd14e8d7c0baf9f872eb 100644 (file)
@@ -222,6 +222,7 @@ public:
        ~DetailAssetThread();
 
        void start(Asset *asset);
+       void stop();
        void run();
 };
 
index f90958e017c0ebfdbbde5f2c0116afce898eb7d9..f277fde29e319d0c7ab32dfb9c93227e61a08836 100644 (file)
@@ -349,6 +349,7 @@ void FormatTools::update_driver(int driver)
                        break;
        }
        close_format_windows();
+       update_format();
 }
 
 void FormatTools::update_format()
@@ -392,7 +393,7 @@ void FormatTools::update_extension()
        const char *extension = File::get_tag(asset->format);
 // split multiple extensions
        ArrayList<const char*> extensions;
-       int len = strlen(extension);
+       int len = !extension ? -1 : strlen(extension);
        const char *extension_ptr = extension;
        for(int i = 0; i <= len; i++)
        {
index 1eb86959e39a5369bd742405a767b2acb81a8e89..1afeecb0d9c61245e6423eaab3160f7c1264c88d 100644 (file)
@@ -38,7 +38,6 @@ static inline int gettid() { return syscall(SYS_gettid, 0, 0, 0); }
 class Thread
 {
        static void* entrypoint(void *parameters);
-       bool exists() { return tid != ((pthread_t)-1); }
 
 protected:
        virtual void run() = 0;
@@ -54,6 +53,7 @@ public:
        int enable_cancel();
        int disable_cancel();
        int get_cancel_enabled();
+       bool exists() { return tid != ((pthread_t)-1); }
        bool running() { return exists() && !finished; }
 
        int get_synchronous();