From d1f1947432cafa5aa4657af72955285f192b2430 Mon Sep 17 00:00:00 2001 From: MattPollard44 Date: Mon, 26 Apr 2021 16:15:28 -0400 Subject: [PATCH] Trying Mutex Lock to fix scroll crash --- Roto/mainwindow.cpp | 2 ++ Roto/mainwindow.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Roto/mainwindow.cpp b/Roto/mainwindow.cpp index 9f11795..374642e 100644 --- a/Roto/mainwindow.cpp +++ b/Roto/mainwindow.cpp @@ -260,6 +260,7 @@ void MainWindow::mouseDoubleClickEvent(QMouseEvent *event) { } void MainWindow::wheelEvent(QWheelEvent *event) { + scrollLock.lock(); if (ioh->getWorkingLayer() == nullptr) return; int dy = event->angleDelta().y(); @@ -302,6 +303,7 @@ void MainWindow::wheelEvent(QWheelEvent *event) { } else if (mode == Raster_Mode) ioh->getWorkingLayer()->spinWheel(dy); + scrollLock.unlock(); refresh(); } diff --git a/Roto/mainwindow.h b/Roto/mainwindow.h index 767f126..bea796b 100644 --- a/Roto/mainwindow.h +++ b/Roto/mainwindow.h @@ -93,6 +93,7 @@ const QString Kernal_Loc = "/Kernals/"; const QString FetchLink = "https://github.com/SCCapstone/SnakyBusiness/raw/master"; const vector acceptedImportImageFormats = {"bmp", "jpg", "jpeg", "png", "ppm", "xbm", "xpm", "gif", "pbm", "pgm"}; const vector acceptedExportImageFormats = {"bmp", "jpg", "jpeg", "png", "ppm", "xbm", "xpm"}; +static mutex scrollLock; enum downloadAction {DownloadThenRestart, DownLoadThenOpen}; @@ -175,6 +176,7 @@ public slots: QProgressDialog *progress; brushShape *brushProlfiler; patternProfiler *pp; + bool lock; }; #endif // MAINWINDOW_H