From 84895a4f793f099a116ad5a5a2217c3e9c019ec1 Mon Sep 17 00:00:00 2001 From: Matthew Krafczyk Date: Tue, 9 Sep 2014 01:11:21 +0200 Subject: [PATCH 1/5] Fix for 'Crash double-clicking any knob in debug build (git master) (#948)' Conflicts: src/gui/widgets/knob.cpp --- include/JournallingObject.h | 3 +++ src/gui/widgets/knob.cpp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/JournallingObject.h b/include/JournallingObject.h index 3f6e47a82..b9ada746e 100644 --- a/include/JournallingObject.h +++ b/include/JournallingObject.h @@ -77,6 +77,9 @@ public: return oldJournalling; } + inline bool isEmpty() { + return m_journallingStateStack.isEmpty(); + } protected: void changeID( jo_id_t _id ); diff --git a/src/gui/widgets/knob.cpp b/src/gui/widgets/knob.cpp index 7bb226795..dabd9cc49 100644 --- a/src/gui/widgets/knob.cpp +++ b/src/gui/widgets/knob.cpp @@ -592,7 +592,9 @@ void knob::mouseReleaseEvent( QMouseEvent* event ) AutomatableModel *thisModel = model(); if( thisModel ) { - thisModel->restoreJournallingState(); + if(!thisModel->isEmpty()) { + thisModel->restoreJournallingState(); + } } } From c628387cd22d2412178c2238af9ee8686ff87fbf Mon Sep 17 00:00:00 2001 From: Matthew Krafczyk Date: Tue, 9 Sep 2014 01:39:08 +0200 Subject: [PATCH 2/5] Make syntax for fix more consistent with existing code. --- include/JournallingObject.h | 3 ++- src/gui/widgets/knob.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/JournallingObject.h b/include/JournallingObject.h index b9ada746e..c3a93a1cd 100644 --- a/include/JournallingObject.h +++ b/include/JournallingObject.h @@ -77,7 +77,8 @@ public: return oldJournalling; } - inline bool isEmpty() { + inline bool isEmpty() const + { return m_journallingStateStack.isEmpty(); } diff --git a/src/gui/widgets/knob.cpp b/src/gui/widgets/knob.cpp index dabd9cc49..141ae143f 100644 --- a/src/gui/widgets/knob.cpp +++ b/src/gui/widgets/knob.cpp @@ -592,7 +592,8 @@ void knob::mouseReleaseEvent( QMouseEvent* event ) AutomatableModel *thisModel = model(); if( thisModel ) { - if(!thisModel->isEmpty()) { + if( !thisModel->isEmpty() ) + { thisModel->restoreJournallingState(); } } From 32eae51128597addfd6a42d02d246cd407824f95 Mon Sep 17 00:00:00 2001 From: Matthew Krafczyk Date: Tue, 9 Sep 2014 17:07:40 +0200 Subject: [PATCH 3/5] Made isEmpty function name more specific. Moved doubleclick fix to restoreJournallingState. --- include/JournallingObject.h | 6 ++++-- src/gui/widgets/knob.cpp | 5 +---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/JournallingObject.h b/include/JournallingObject.h index c3a93a1cd..441d27220 100644 --- a/include/JournallingObject.h +++ b/include/JournallingObject.h @@ -50,7 +50,9 @@ public: void restoreJournallingState() { - m_journalling = m_journallingStateStack.pop(); + if( !isJournallingStackEmpty()) { + m_journalling = m_journallingStateStack.pop(); + } } void addJournalCheckPoint(); @@ -77,7 +79,7 @@ public: return oldJournalling; } - inline bool isEmpty() const + inline bool isJournallingStackEmpty() const { return m_journallingStateStack.isEmpty(); } diff --git a/src/gui/widgets/knob.cpp b/src/gui/widgets/knob.cpp index 141ae143f..7bb226795 100644 --- a/src/gui/widgets/knob.cpp +++ b/src/gui/widgets/knob.cpp @@ -592,10 +592,7 @@ void knob::mouseReleaseEvent( QMouseEvent* event ) AutomatableModel *thisModel = model(); if( thisModel ) { - if( !thisModel->isEmpty() ) - { - thisModel->restoreJournallingState(); - } + thisModel->restoreJournallingState(); } } From 0cdfd7c354cfd1fa2276fdd73ef70ebe5e27c971 Mon Sep 17 00:00:00 2001 From: Matthew Krafczyk Date: Tue, 9 Sep 2014 17:15:54 +0200 Subject: [PATCH 4/5] Fix syntax a bit. --- include/JournallingObject.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/JournallingObject.h b/include/JournallingObject.h index 441d27220..5b266daad 100644 --- a/include/JournallingObject.h +++ b/include/JournallingObject.h @@ -50,7 +50,8 @@ public: void restoreJournallingState() { - if( !isJournallingStackEmpty()) { + if( !isJournallingStackEmpty()) + { m_journalling = m_journallingStateStack.pop(); } } From e20e863a99d9b2076041d93592986bfd268337c1 Mon Sep 17 00:00:00 2001 From: Matthew Krafczyk Date: Tue, 9 Sep 2014 20:08:14 +0200 Subject: [PATCH 5/5] Change isJournallingStackEmpty to isJournallingStateStackEmpty --- include/JournallingObject.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/JournallingObject.h b/include/JournallingObject.h index 5b266daad..8a2627716 100644 --- a/include/JournallingObject.h +++ b/include/JournallingObject.h @@ -50,7 +50,7 @@ public: void restoreJournallingState() { - if( !isJournallingStackEmpty()) + if( !isJournallingStateStackEmpty()) { m_journalling = m_journallingStateStack.pop(); } @@ -80,7 +80,7 @@ public: return oldJournalling; } - inline bool isJournallingStackEmpty() const + bool isJournallingStateStackEmpty() const { return m_journallingStateStack.isEmpty(); }