remove asset while preview active segv fix, guard against segv with missing asset...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mwindow.C
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);