From afa6dea68a31d6ce76b915f3374f0e7d77fbcf05 Mon Sep 17 00:00:00 2001 From: Person Date: Fri, 28 Jun 2019 18:51:36 -0700 Subject: [PATCH 1/3] --Bug fixes -Rapidly stopping and starting sequence preview generation would either freeze or crash the program. --- .../Fractorium/FractoriumEmberController.cpp | 13 ++++++---- Source/Fractorium/FractoriumEmberController.h | 1 - Source/Fractorium/FractoriumLibrary.cpp | 26 ++++--------------- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/Source/Fractorium/FractoriumEmberController.cpp b/Source/Fractorium/FractoriumEmberController.cpp index e3eecf8..2547fbb 100644 --- a/Source/Fractorium/FractoriumEmberController.cpp +++ b/Source/Fractorium/FractoriumEmberController.cpp @@ -400,11 +400,14 @@ void TreePreviewRenderer::PreviewRenderFunc(uint start, uint end) //It is critical that Qt::BlockingQueuedConnection is passed because this is running on a different thread than the UI. //This ensures the events are processed in order as each preview is updated, and that control does not return here //until the update is complete. - QMetaObject::invokeMethod(f, "SetLibraryTreeItemData", Qt::BlockingQueuedConnection, - Q_ARG(EmberTreeWidgetItemBase*, treeItem), - Q_ARG(vv4F&, m_PreviewFinalImage), - Q_ARG(uint, PREVIEW_SIZE), - Q_ARG(uint, PREVIEW_SIZE)); + if (m_PreviewRun) + { + QMetaObject::invokeMethod(f, "SetLibraryTreeItemData", Qt::DirectConnection, + Q_ARG(EmberTreeWidgetItemBase*, treeItem), + Q_ARG(vv4F&, m_PreviewFinalImage), + Q_ARG(uint, PREVIEW_SIZE), + Q_ARG(uint, PREVIEW_SIZE)); + } } } } diff --git a/Source/Fractorium/FractoriumEmberController.h b/Source/Fractorium/FractoriumEmberController.h index 4f74f6c..c35ea92 100644 --- a/Source/Fractorium/FractoriumEmberController.h +++ b/Source/Fractorium/FractoriumEmberController.h @@ -625,7 +625,6 @@ public: { m_PreviewRun = false; m_PreviewRenderer.Abort(); - m_PreviewResult.cancel(); m_PreviewResult.waitForFinished(); } diff --git a/Source/Fractorium/FractoriumLibrary.cpp b/Source/Fractorium/FractoriumLibrary.cpp index e757dfc..750e5fd 100644 --- a/Source/Fractorium/FractoriumLibrary.cpp +++ b/Source/Fractorium/FractoriumLibrary.cpp @@ -132,7 +132,6 @@ void FractoriumEmberController::SyncLibrary(eLibraryUpdate update) { auto it = m_EmberFile.m_Embers.begin(); auto tree = m_Fractorium->ui.LibraryTree; - tree->blockSignals(true); if (auto top = tree->topLevelItem(0)) { @@ -154,8 +153,6 @@ void FractoriumEmberController::SyncLibrary(eLibraryUpdate update) } } } - - tree->blockSignals(false); } /// @@ -173,8 +170,7 @@ void FractoriumEmberController::FillLibraryTree(int selectIndex) vector v(size * size * 4); StopAllPreviewRenderers(); tree->clear(); - QCoreApplication::flush(); - tree->blockSignals(true); + QCoreApplication::processEvents(); auto fileItem = new QTreeWidgetItem(tree); QFileInfo info(m_EmberFile.m_Filename); fileItem->setText(0, info.fileName()); @@ -194,13 +190,10 @@ void FractoriumEmberController::FillLibraryTree(int selectIndex) emberItem->SetImage(v, size, size); } - tree->blockSignals(false); - if (selectIndex != -1) m_Fractorium->SelectLibraryItem(selectIndex); m_Fractorium->SyncFileCountToSequenceCount(); - QCoreApplication::flush(); RenderLibraryPreviews(0, uint(m_EmberFile.Size())); tree->expandAll(); } @@ -220,7 +213,6 @@ void FractoriumEmberController::UpdateLibraryTree() { int origChildCount = top->childCount(); int i = origChildCount; - tree->blockSignals(true); for (auto it = Advance(m_EmberFile.m_Embers.begin(), i); it != m_EmberFile.m_Embers.end(); ++it) { @@ -238,7 +230,6 @@ void FractoriumEmberController::UpdateLibraryTree() //When adding elements, ensure all indices are sequential. SyncLibrary(eLibraryUpdate::INDEX); m_Fractorium->SyncFileCountToSequenceCount(); - tree->blockSignals(false); RenderLibraryPreviews(origChildCount, uint(m_EmberFile.Size())); } } @@ -277,7 +268,6 @@ void FractoriumEmberController::EmberTreeItemChanged(QTreeWidgetItem* item, i if (oldName == newName)//If nothing changed, nothing to do. return; - tree->blockSignals(true); emberItem->UpdateEmberName();//Copy edit text to the ember's name variable. m_EmberFile.MakeNamesUnique();//Ensure all names remain unique. SyncLibrary(eLibraryUpdate::NAME);//Copy all ember names to the tree items since some might have changed to be made unique. @@ -289,7 +279,6 @@ void FractoriumEmberController::EmberTreeItemChanged(QTreeWidgetItem* item, i m_LastSaveCurrent = "";//Reset will force the dialog to show on the next save current since the user probably wants a different name. } - tree->blockSignals(false); } else if (auto parentItem = dynamic_cast(item)) { @@ -433,8 +422,6 @@ void FractoriumEmberController::RenderPreviews(QTreeWidget* tree, TreePreview if (start == UINT_MAX && end == UINT_MAX) { - tree->blockSignals(true); - if (auto top = tree->topLevelItem(0)) { int childCount = top->childCount(); @@ -445,7 +432,6 @@ void FractoriumEmberController::RenderPreviews(QTreeWidget* tree, TreePreview treeItem->SetImage(emptyPreview, PREVIEW_SIZE, PREVIEW_SIZE); } - tree->blockSignals(false); renderer->Render(0, uint(file.Size())); } else @@ -490,8 +476,7 @@ void FractoriumEmberController::FillSequenceTree() vector v(size * size * 4); m_SequencePreviewRenderer->Stop(); tree->clear(); - QCoreApplication::flush(); - tree->blockSignals(true); + QCoreApplication::processEvents();//Having to flush events is usually a sign of poor design. However, in this case, it's critical to have this here, else rapid button clicks will crash. auto fileItem = new QTreeWidgetItem(tree); QFileInfo info(m_SequenceFile.m_Filename); fileItem->setText(0, info.fileName()); @@ -503,19 +488,18 @@ void FractoriumEmberController::FillSequenceTree() auto emberItem = new EmberTreeWidgetItemBase(fileItem); if (it.m_Name.empty()) - emberItem->setText(0, ToString(i++)); + emberItem->setText(0, ToString(i)); else emberItem->setText(0, it.m_Name.c_str()); + i++; emberItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); emberItem->setToolTip(0, emberItem->text(0)); emberItem->SetImage(v, size, size); } - tree->blockSignals(false); - QCoreApplication::flush(); - RenderSequencePreviews(0, uint(m_SequenceFile.Size())); tree->expandAll(); + RenderSequencePreviews(0, uint(m_SequenceFile.Size())); } /// From 0ac80217f77b46730e28e131a6dfb12b11560b70 Mon Sep 17 00:00:00 2001 From: Person Date: Fri, 28 Jun 2019 21:07:18 -0700 Subject: [PATCH 2/3] 1.0.0.17 Re-release --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 59432a0..7d66622 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +fractorium (1.0.0.17a-0ubuntu1) bionic; urgency=low + + * release 1.0.0.17 + + -- Matt Feemster Fri, 28 Jun 2019 21:04:38 -0700 + fractorium (1.0.0.17-0ubuntu1) bionic; urgency=low * release 1.0.0.17 From 1cafbb8837ba7a5f7fab8d181ddcca1fdcb93cc6 Mon Sep 17 00:00:00 2001 From: Person Date: Sun, 30 Jun 2019 20:44:07 -0700 Subject: [PATCH 3/3] --User changes -Add entries for 1 and 101 in the affine rotation and scale combo boxes. --- Source/Fractorium/Fractorium.ui | 20 ++++++++++++++++++++ Source/Fractorium/FractoriumLibrary.cpp | 1 - 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Source/Fractorium/Fractorium.ui b/Source/Fractorium/Fractorium.ui index 440b7d1..5968cec 100644 --- a/Source/Fractorium/Fractorium.ui +++ b/Source/Fractorium/Fractorium.ui @@ -4410,6 +4410,11 @@ true + + + 101 + + 110 @@ -4665,6 +4670,11 @@ true + + + 1 + + 5 @@ -5279,6 +5289,11 @@ true + + + 1 + + 5 @@ -5620,6 +5635,11 @@ true + + + 101 + + 110 diff --git a/Source/Fractorium/FractoriumLibrary.cpp b/Source/Fractorium/FractoriumLibrary.cpp index 750e5fd..6d2d81b 100644 --- a/Source/Fractorium/FractoriumLibrary.cpp +++ b/Source/Fractorium/FractoriumLibrary.cpp @@ -278,7 +278,6 @@ void FractoriumEmberController::EmberTreeItemChanged(QTreeWidgetItem* item, i m_Ember.m_Name = newName; m_LastSaveCurrent = "";//Reset will force the dialog to show on the next save current since the user probably wants a different name. } - } else if (auto parentItem = dynamic_cast(item)) {