From: Good Guy Date: Sun, 27 Sep 2015 18:48:25 +0000 (-0600) Subject: fix segv in formattools for record format ffmpeg X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=0a0465887db91fe96bc4a5641cc76354a8ddeaa6;p=goodguy%2Fhistory.git fix segv in formattools for record format ffmpeg --- diff --git a/cinelerra-5.0/cinelerra/assetedit.C b/cinelerra-5.0/cinelerra/assetedit.C index c7ef9f24..5422d97e 100644 --- a/cinelerra-5.0/cinelerra/assetedit.C +++ b/cinelerra-5.0/cinelerra/assetedit.C @@ -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() diff --git a/cinelerra-5.0/cinelerra/assetedit.h b/cinelerra-5.0/cinelerra/assetedit.h index 06f72e79..32199f06 100644 --- a/cinelerra-5.0/cinelerra/assetedit.h +++ b/cinelerra-5.0/cinelerra/assetedit.h @@ -222,6 +222,7 @@ public: ~DetailAssetThread(); void start(Asset *asset); + void stop(); void run(); }; diff --git a/cinelerra-5.0/cinelerra/formattools.C b/cinelerra-5.0/cinelerra/formattools.C index f90958e0..f277fde2 100644 --- a/cinelerra-5.0/cinelerra/formattools.C +++ b/cinelerra-5.0/cinelerra/formattools.C @@ -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 extensions; - int len = strlen(extension); + int len = !extension ? -1 : strlen(extension); const char *extension_ptr = extension; for(int i = 0; i <= len; i++) { diff --git a/cinelerra-5.0/guicast/thread.h b/cinelerra-5.0/guicast/thread.h index 1eb86959..1afeecb0 100644 --- a/cinelerra-5.0/guicast/thread.h +++ b/cinelerra-5.0/guicast/thread.h @@ -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();