fixed occasional gl crash on close and made import context menu item always available
This commit is contained in:
@@ -10,6 +10,7 @@ void CrossDissolveTransition::process_coords(double progress, GLTextureCoords&,
|
||||
if (!(data == TA_CLOSING_TRANSITION && secondary_clip != NULL)) {
|
||||
float color[4];
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
if (data == TA_CLOSING_TRANSITION) progress = 1.0 - progress;
|
||||
glColor4f(1.0, 1.0, 1.0, color[3]*progress);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -222,6 +222,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
panel_sequence_viewer->viewer_widget->delete_function();
|
||||
panel_footage_viewer->viewer_widget->delete_function();
|
||||
|
||||
set_sequence(NULL);
|
||||
|
||||
QString data_dir = get_data_path();
|
||||
@@ -248,11 +251,11 @@ MainWindow::~MainWindow() {
|
||||
|
||||
delete ui;
|
||||
|
||||
delete panel_sequence_viewer;
|
||||
delete panel_footage_viewer;
|
||||
delete panel_project;
|
||||
delete panel_effect_controls;
|
||||
delete panel_timeline;
|
||||
delete panel_sequence_viewer;
|
||||
delete panel_footage_viewer;
|
||||
|
||||
close_debug();
|
||||
}
|
||||
|
||||
@@ -431,7 +431,6 @@ void cache_video_worker(Clip* c, long playhead) {
|
||||
bool reverse = (c->reverse && !c->ignore_reverse);
|
||||
c->ignore_reverse = false;
|
||||
|
||||
int64_t eighth_second = av_q2d(av_inv_q(c->stream->time_base))*0.125;
|
||||
int64_t smallest_pts = INT64_MAX;
|
||||
if (reverse && c->queue.size() > 0) {
|
||||
int64_t quarter_sec = qRound64(av_q2d(av_inv_q(c->stream->time_base))) >> 2;
|
||||
|
||||
+6
-6
@@ -39,13 +39,13 @@ SourceTable::SourceTable(QWidget* parent) : QTreeWidget(parent) {
|
||||
void SourceTable::show_context_menu() {
|
||||
QMenu menu(this);
|
||||
|
||||
if (selectedItems().size() == 0) {
|
||||
QAction* import_action = menu.addAction("Import...");
|
||||
connect(import_action, SIGNAL(triggered(bool)), panel_project, SLOT(import_dialog()));
|
||||
QAction* import_action = menu.addAction("Import...");
|
||||
connect(import_action, SIGNAL(triggered(bool)), panel_project, SLOT(import_dialog()));
|
||||
|
||||
QAction* new_folder_action = menu.addAction("New Folder...");
|
||||
connect(new_folder_action, SIGNAL(triggered(bool)), mainWindow, SLOT(on_actionFolder_triggered()));
|
||||
} else {
|
||||
QAction* new_folder_action = menu.addAction("New Folder...");
|
||||
connect(new_folder_action, SIGNAL(triggered(bool)), mainWindow, SLOT(on_actionFolder_triggered()));
|
||||
|
||||
if (selectedItems().size() > 0) {
|
||||
if (selectedItems().size() == 1) {
|
||||
// replace footage
|
||||
int type = get_type_from_tree(selectedItems().at(0));
|
||||
|
||||
+25
-16
@@ -73,7 +73,7 @@ void TimelineWidget::right_click_ripple() {
|
||||
|
||||
void TimelineWidget::show_context_menu(const QPoint& pos) {
|
||||
if (sequence != NULL) {
|
||||
// hack because sometimes right clicking doesn't trigger mouseReleaseEvent
|
||||
// hack because sometimes right clicking doesn't trigger mouse release event
|
||||
panel_timeline->rect_select_init = false;
|
||||
panel_timeline->rect_select_proc = false;
|
||||
|
||||
@@ -909,7 +909,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
sequence->clips.at(g.clip)->undeletable = true;
|
||||
if (g.transition != NULL) {
|
||||
g.transition->parent_clip->undeletable = true;
|
||||
g.transition->secondary_clip->undeletable = true;
|
||||
if (g.transition->secondary_clip != NULL) g.transition->secondary_clip->undeletable = true;
|
||||
}
|
||||
|
||||
Selection s;
|
||||
@@ -924,7 +924,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
sequence->clips.at(g.clip)->undeletable = false;
|
||||
if (g.transition != NULL) {
|
||||
g.transition->parent_clip->undeletable = false;
|
||||
g.transition->secondary_clip->undeletable = false;
|
||||
if (g.transition->secondary_clip != NULL) g.transition->secondary_clip->undeletable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1157,7 +1157,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
if (panel_timeline->tool != TIMELINE_TOOL_SLIP) {
|
||||
// slipping doesn't move the clips so we don't bother snapping for it
|
||||
for (int i=0;i<panel_timeline->ghosts.size();i++) {
|
||||
Ghost& g = panel_timeline->ghosts[i];
|
||||
const Ghost& g = panel_timeline->ghosts.at(i);
|
||||
if (panel_timeline->trim_target == -1 || g.trim_in) {
|
||||
fm = g.old_in + frame_diff;
|
||||
if (panel_timeline->snap_to_timeline(&fm, true, true, true)) {
|
||||
@@ -1281,19 +1281,28 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
|
||||
if (g.transition != NULL) {
|
||||
// prevent clip_in from going below 0
|
||||
if (c->media_type == MEDIA_TYPE_SEQUENCE
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + frame_diff;
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
}
|
||||
if (g.transition->secondary_clip != NULL) {
|
||||
// prevent dual transitions from going below 0 on the primary or above media length on the secondary
|
||||
validator = g.transition->parent_clip->get_clip_in_with_transition() + frame_diff;
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
|
||||
// prevent clip length exceeding media length
|
||||
if (c->media_type == MEDIA_TYPE_SEQUENCE
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + g.ghost_length + frame_diff;
|
||||
if (validator > g.media_length) frame_diff -= validator - g.media_length;
|
||||
}
|
||||
validator = g.transition->secondary_clip->get_timeline_out_with_transition() - g.transition->secondary_clip->get_timeline_in_with_transition() + g.transition->secondary_clip->get_clip_in_with_transition() + frame_diff - g.transition->secondary_clip->getMaximumLength();
|
||||
if (validator > 0) frame_diff -= validator;
|
||||
} else {
|
||||
// prevent clip_in from going below 0
|
||||
if (c->media_type == MEDIA_TYPE_SEQUENCE
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + frame_diff;
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
}
|
||||
|
||||
// prevent clip length exceeding media length
|
||||
if (c->media_type == MEDIA_TYPE_SEQUENCE
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + g.ghost_length + frame_diff;
|
||||
if (validator > g.media_length) frame_diff -= validator - g.media_length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// prevent clips from crossing tracks
|
||||
|
||||
+8
-6
@@ -51,14 +51,16 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
|
||||
connect(&retry_timer, SIGNAL(timeout()), this, SLOT(retry()));
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
}
|
||||
|
||||
void ViewerWidget::deleteFunction() {
|
||||
void ViewerWidget::delete_function() {
|
||||
// destroy all textures as well
|
||||
makeCurrent();
|
||||
closeActiveClips(viewer->seq, true);
|
||||
doneCurrent();
|
||||
if (viewer->seq != NULL) {
|
||||
makeCurrent();
|
||||
closeActiveClips(viewer->seq, true);
|
||||
doneCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerWidget::show_context_menu() {
|
||||
@@ -107,7 +109,7 @@ void ViewerWidget::retry() {
|
||||
}
|
||||
|
||||
void ViewerWidget::initializeGL() {
|
||||
connect(context(), SIGNAL(aboutToBeDestroyed()), this, SLOT(deleteFunction()), Qt::DirectConnection);
|
||||
connect(context(), SIGNAL(aboutToBeDestroyed()), this, SLOT(delete_function()), Qt::DirectConnection);
|
||||
|
||||
retry_timer.start();
|
||||
}
|
||||
|
||||
+3
-2
@@ -20,7 +20,7 @@ class ViewerWidget : public QOpenGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ViewerWidget(QWidget *parent = 0);
|
||||
ViewerWidget(QWidget *parent = 0);
|
||||
|
||||
void paintGL();
|
||||
void initializeGL();
|
||||
@@ -31,6 +31,8 @@ public:
|
||||
bool waveform;
|
||||
Clip* waveform_clip;
|
||||
MediaStream* waveform_ms;
|
||||
public slots:
|
||||
void delete_function();
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
// void resizeGL(int w, int h);
|
||||
@@ -47,7 +49,6 @@ private:
|
||||
void process_effect(Clip* c, Effect* e, double timecode, GLTextureCoords& coords, GLuint& composite_texture, bool& fbo_switcher, int data);
|
||||
private slots:
|
||||
void retry();
|
||||
void deleteFunction();
|
||||
void show_context_menu();
|
||||
void save_frame();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user