remove asset while preview active segv fix, guard against segv with missing asset...
authorGood Guy <good1.2guy@gmail.com>
Sun, 9 Dec 2018 02:27:22 +0000 (19:27 -0700)
committerGood Guy <good1.2guy@gmail.com>
Sun, 9 Dec 2018 02:27:22 +0000 (19:27 -0700)
cinelerra-5.1/cinelerra/asset.C
cinelerra-5.1/cinelerra/assetpopup.C
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/awindowgui.h
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindowgui.C

index 4f911e984d544803057547946beb7b9de4ddd55e..2856ed5c0dde278aa7661dfdaa322ca177671061 100644 (file)
@@ -603,7 +603,8 @@ int Asset::write(FileXML *file,
        write_audio(file);
        write_video(file);
 // index goes after source
-       if(index_state->index_status == INDEX_READY && include_index)
+       if( include_index && index_state &&
+           index_state->index_status == INDEX_READY )
                write_index(file);
 
        file->tag.set_title("/ASSET");
index f7961c7d346b97f0e5e12b7a06e6a8ae51b8b1b7..102c803c8d943b36e1cbbed377021244b170d451 100644 (file)
@@ -359,9 +359,11 @@ AssetPopupProjectRemove::~AssetPopupProjectRemove()
 
 int AssetPopupProjectRemove::handle_event()
 {
+       popup->gui->unlock_window();
        mwindow->remove_assets_from_project(1, 1,
                mwindow->session->drag_assets,
                mwindow->session->drag_clips);
+       popup->gui->lock_window("AssetPopupProjectRemove::handle_event");
        return 1;
 }
 
index b370b2c3f542ac048996b144e6dbd890cc854410..45954b76ca596053cc8a886aa714d56b708d2418 100644 (file)
@@ -547,10 +547,22 @@ AssetVIconThread::AssetVIconThread(AWindowGUI *gui, Preferences *preferences)
        case VICON_COLOR_MODE_HIGH:  vicon_cmodel = BC_RGB888;  break;
        }
        this->vicon_cmodel = vicon_cmodel;
+       this->draw_lock = new Mutex("AssetVIconThread::draw_lock");
 }
 
 AssetVIconThread::~AssetVIconThread()
 {
+       delete draw_lock;
+}
+
+void AssetVIconThread::drawing_started()
+{
+       draw_lock->lock("AssetVIconThread::drawing_started");
+}
+
+void AssetVIconThread::drawing_stopped()
+{
+       draw_lock->unlock();
 }
 
 void AssetVIconThread::set_view_popup(AssetVIcon *v, int draw_mode)
index 388ae622fcc730fb72497db5b9849d8e84683e36..13ccda9085d2b6a0f7c3191a2fb8648c6105ff08 100644 (file)
@@ -194,10 +194,13 @@ public:
 
        void set_view_popup(AssetVIcon *v, int draw_mode=-1);
        ViewPopup *new_view_window();
+       void drawing_started();
+       void drawing_stopped();
 
        AWindowGUI *gui;
        int draw_mode;
        int vicon_cmodel;
+       Mutex *draw_lock;
 };
 
 
index 070353020f8195996b02b77b0a371d316ca94b38..5fde46cc777d3ecf986554ba31354881e8af0591 100644 (file)
 #include "vframe.h"
 #include "vtrack.h"
 #include "versioninfo.h"
+#include "vicon.h"
 #include "videodevice.inc"
 #include "videowindow.h"
 #include "vplayback.h"
@@ -4010,6 +4011,10 @@ void MWindow::remove_asset_from_caches(Asset *asset)
 void MWindow::remove_assets_from_project(int push_undo, int redraw,
                ArrayList<Indexable*> *drag_assets, ArrayList<EDL*> *drag_clips)
 {
+       awindow->gui->vicon_thread->stop_drawing();
+       awindow->gui->vicon_thread->drawing_started(); // waits for draw lock
+       awindow->gui->vicon_thread->drawing_stopped();
+
        for(int i = 0; i < drag_assets->total; i++) {
                Indexable *indexable = drag_assets->get(i);
                if(indexable->is_asset) remove_asset_from_caches((Asset*)indexable);
index 36532ac7da51752a2b1cdd9d3f52bc2bd93d49d4..d121f29eb222ffba4ad67532455e2aa12bf1fa9b 100644 (file)
@@ -2404,10 +2404,12 @@ ProxyToggle::~ProxyToggle()
 int ProxyToggle::handle_event()
 {
        int disabled = get_value();
+       mwindow->gui->unlock_window();
        if( disabled )
                mwindow->disable_proxy();
        else
                mwindow->enable_proxy();
+       mwindow->gui->lock_window("ProxyToggle::handle_event");
        set_tooltip(!disabled ? _("Disable proxy") : _("Enable proxy"));
        return 1;
 }