Bug#765341: Please don't let audacity freeze like this...

Martin Steghöfer martin at steghoefer.eu
Sat Oct 25 16:52:58 UTC 2014


Martin Steghöfer wrote:
> Andoru Ekkusu wrote:
>> Does anyone have any idea when this patch will be committed?
>
> Hopefully soon, otherwise the new package won't make it to testing in 
> time before the freeze. Then getting the fix into jessie will become 
> much more complicated. I think it's quite important for the usability 
> to have these remaining issues fixed.

Attaching a debdiff fixing the bugs #765341 and #765779 - in case that 
helps.

Cheers,
Martin

-------------- next part --------------
diff -Nru audacity-2.0.6/debian/changelog audacity-2.0.6/debian/changelog
--- audacity-2.0.6/debian/changelog	2014-10-14 01:28:54.000000000 +0200
+++ audacity-2.0.6/debian/changelog	2014-10-25 16:54:13.000000000 +0200
@@ -1,3 +1,12 @@
+audacity (2.0.6-2) unstable; urgency=medium
+
+  * Workaround for wx bug causing layout problems in recovery dialog.
+  * Fix effect dialog segfault due to events before initialization and
+    add workaround for wxWidgets bug "Reentry in clipboard". (Closes: #765341)
+  * Fix cursor recapturing in track panel sliders. (Closes: #765779)
+
+ -- Martin Steghöfer <martin at steghoefer.eu>  Sat, 25 Oct 2014 16:16:17 +0200
+
 audacity (2.0.6-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru audacity-2.0.6/debian/patches/fix-cursor-recapturing-sliders.patch audacity-2.0.6/debian/patches/fix-cursor-recapturing-sliders.patch
--- audacity-2.0.6/debian/patches/fix-cursor-recapturing-sliders.patch	1970-01-01 01:00:00.000000000 +0100
+++ audacity-2.0.6/debian/patches/fix-cursor-recapturing-sliders.patch	2014-10-25 16:48:02.000000000 +0200
@@ -0,0 +1,26 @@
+Description: Fix cursor recapturing in track panel sliders
+ wxWidgets 3.0 has added a lot of asserts to detect incorrect usage
+ of its APIs. Now capturing the cursor, when it's already captured,
+ throughs an assertion failure. This can be the case in the track
+ panel sliders because the sliders capture the cursor themselves
+ (because they are also used in other places outside the track panel,
+ where this is actually necessary), but the track panel also manages
+ the cursor capturing because it needs it for other operations.
+ Fix the recapturing problem by letting the sliders capture the cursor
+ only if necessary.
+Author: Martin Steghöfer <martin at steghoefer.eu>
+Bug-Debian: https://bugs.debian.org/
+
+--- a/src/widgets/ASlider.cpp
++++ b/src/widgets/ASlider.cpp
+@@ -1070,7 +1070,9 @@ void LWSlider::OnMouseEvent(wxMouseEvent & event)
+                event.ShiftDown());
+       }
+ 
+-      mParent->CaptureMouse();
++      if (!mParent->HasCapture()) {
++         mParent->CaptureMouse();
++      }
+       // wxSetCursor(wxCURSOR_BLANK);
+       ((TipPanel*)LWSlider::sharedTipPanel)->SetTargetParent(mParent);
+       FormatPopWin();
diff -Nru audacity-2.0.6/debian/patches/series audacity-2.0.6/debian/patches/series
--- audacity-2.0.6/debian/patches/series	2014-10-14 01:24:08.000000000 +0200
+++ audacity-2.0.6/debian/patches/series	2014-10-25 16:56:23.000000000 +0200
@@ -1,3 +1,7 @@
 fix-minsrc-autoreconf.patch
 wxWidgets-3.0.patch
 clang-ftbfs.patch
+fix-cursor-recapturing-sliders.patch
+workaround-wxwidgets-fit-recovery.patch
+wxwidgets-clipboard-reentry-workaround.patch
+wxwidgets-effect-dialogs-segfault.patch
diff -Nru audacity-2.0.6/debian/patches/workaround-wxwidgets-fit-recovery.patch audacity-2.0.6/debian/patches/workaround-wxwidgets-fit-recovery.patch
--- audacity-2.0.6/debian/patches/workaround-wxwidgets-fit-recovery.patch	1970-01-01 01:00:00.000000000 +0100
+++ audacity-2.0.6/debian/patches/workaround-wxwidgets-fit-recovery.patch	2014-10-25 16:48:59.000000000 +0200
@@ -0,0 +1,65 @@
+Description: Workaround for wx bug causing layout problems in recovery dialog
+ Workaround for a bug in wxWidgets 3.0 that causes the Fit()
+ function to fail in certain desktop environments (gnome, xfce) 
+ before the first window of the same style class is shown on
+ screen (http://trac.wxwidgets.org/ticket/16440). As a workaround,
+ call Fit() and other methods that depend on its results again
+ *after* we know that the window has been shown. While the bug
+ may affect other calls to Fit() on a low level, the workaround
+ is necessary only for the recovery dialog, which is particularly
+ vulnerable because:
+ 1. It is shown very, very early in the program execution and
+ therefore very likely to be the first dialog of its style class
+ shown on screen.
+ 2. It doesn't have scrollbars or flexible-size controls that
+ could compensate the wrong dialog size.
+Author: Martin Steghöfer <martin at steghoefer.eu>
+Forwarded: lllucius at gmail.com, 2014-10-20
+Bug-Debian: http://bugs.debian.org/765341
+
+--- a/src/AutoRecovery.cpp
++++ b/src/AutoRecovery.cpp
+@@ -38,6 +38,10 @@
+ public:
+    AutoRecoveryDialog(wxWindow *parent);
+ 
++#if defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0)
++   void OnShow(wxShowEvent & event);
++#endif
++
+ private:
+    void PopulateList();
+    void PopulateOrExchange(ShuttleGui & S);
+@@ -65,6 +69,9 @@
+    EVT_BUTTON(ID_RECOVER_ALL, AutoRecoveryDialog::OnRecoverAll)
+    EVT_BUTTON(ID_RECOVER_NONE, AutoRecoveryDialog::OnRecoverNone)
+    EVT_BUTTON(ID_QUIT_AUDACITY, AutoRecoveryDialog::OnQuitAudacity)
++#if defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0)
++   EVT_SHOW(AutoRecoveryDialog::OnShow)
++#endif
+ END_EVENT_TABLE()
+ 
+ void AutoRecoveryDialog::PopulateOrExchange(ShuttleGui& S)
+@@ -102,6 +109,22 @@
+    Center();
+ }
+ 
++#if defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0)
++void AutoRecoveryDialog::OnShow(wxShowEvent & event)
++{
++   // Workaround for wxWidgets bug #16440:
++   // http://trac.wxwidgets.org/ticket/16440
++   // Fit() doesn't work correctly in some desktop environments
++   // with GTK. But it does work after the first window of the
++   // same style class has been shown on screen. So re-execute
++   // Fit() and other methods that depend on its result AFTER
++   // we know that the window has been shown.
++   Fit();
++   SetMinSize(GetSize());
++   Center();
++}
++#endif
++
+ void AutoRecoveryDialog::PopulateList()
+ {
+    mFileList->DeleteAllItems();
diff -Nru audacity-2.0.6/debian/patches/wxwidgets-clipboard-reentry-workaround.patch audacity-2.0.6/debian/patches/wxwidgets-clipboard-reentry-workaround.patch
--- audacity-2.0.6/debian/patches/wxwidgets-clipboard-reentry-workaround.patch	1970-01-01 01:00:00.000000000 +0100
+++ audacity-2.0.6/debian/patches/wxwidgets-clipboard-reentry-workaround.patch	2014-10-25 16:49:17.000000000 +0200
@@ -0,0 +1,85 @@
+Description: Workaround for wxWidgets bug: Reentry in clipboard
+ The wxWidgets bug http://trac.wxwidgets.org/ticket/16636 prevents
+ us from doing clipboard operations in wxShowEvent and wxTimerEvent
+ processing because those event could possibly be processed during
+ the (not sufficiently protected) Yield() of a first clipboard
+ operation, causing reentry. Audacity had a workaround in place
+ for this problem (the class "CaptureEvents"), which however isn't
+ applicable with wxWidgets 3.0 because it's based on changing the
+ gdk event handler, a change that would be overridden by wxWidgets's
+ own gdk event handler change.
+ Instead, as a new workaround, specifically protect those processings
+ of wxShowEvent and wxTimerEvent that try to do clipboard operations
+ from being executed within Yield(). This is done by delaying their
+ execution by posting pure wxWidgets events - which are never executed
+ during Yield().
+Author: Martin Steghöfer <martin at steghoefer.eu>
+Bug-Debian: https://bugs.debian.org/765341
+
+--- a/src/Project.cpp
++++ b/src/Project.cpp
+@@ -1625,9 +1625,13 @@
+ 
+    // Call "OnSize" again (the previous calls to "OnSize" might not
+    // have succeeded because some methods are not available before
+-   // the actual creation/showing of the window)
+-   wxSizeEvent sizeEvent(GetSize());
+-   OnSize(sizeEvent);
++   // the actual creation/showing of the window).
++   // Post the event instead of calling OnSize(..) directly. This ensures that
++   // this is a pure wxWidgets event (no GDK event behind it) and that it
++   // therefore isn't processed within the YieldFor(..) of the clipboard
++   // operations (workaround for Debian bug #765341).
++   wxSizeEvent *sizeEvent = new wxSizeEvent(GetSize());
++   GetEventHandler()->QueueEvent(sizeEvent);
+ 
+    // Further processing by default handlers
+    event.Skip();
+--- a/src/TrackPanel.cpp
++++ b/src/TrackPanel.cpp
+@@ -360,6 +360,8 @@
+     EVT_MENU(OnTimeTrackLinID, TrackPanel::OnTimeTrackLin)
+     EVT_MENU(OnTimeTrackLogID, TrackPanel::OnTimeTrackLog)
+     EVT_MENU(OnTimeTrackLogIntID, TrackPanel::OnTimeTrackLogInt)
++
++    EVT_TIMER(wxID_ANY, TrackPanel::OnTimer)
+ END_EVENT_TABLE()
+ 
+ /// Makes a cursor from an XPM, uses CursorId as a fallback.
+@@ -927,7 +929,7 @@
+ }
+ 
+ /// AS: This gets called on our wx timer events.
+-void TrackPanel::OnTimer()
++void TrackPanel::OnTimer(wxTimerEvent& event)
+ {
+    mTimeCount++;
+    // AS: If the user is dragging the mouse and there is a track that
+--- a/src/TrackPanel.h
++++ b/src/TrackPanel.h
+@@ -207,7 +207,7 @@
+ 
+    virtual double GetMostRecentXPos();
+ 
+-   virtual void OnTimer();
++   virtual void OnTimer(wxTimerEvent& event);
+ 
+    virtual int GetLeftOffset() const { return GetLabelWidth() + 1;}
+ 
+@@ -541,7 +541,15 @@
+ 
+    class AUDACITY_DLL_API AudacityTimer:public wxTimer {
+    public:
+-     virtual void Notify() { parent->OnTimer(); }
++     virtual void Notify() {
++       // Don't call parent->OnTimer(..) directly here, but instead post
++       // an event. This ensures that this is a pure wxWidgets event
++       // (no GDK event behind it) and that it therefore isn't processed
++       // within the YieldFor(..) of the clipboard operations (workaround
++       // for Debian bug #765341).
++       wxTimerEvent *event = new wxTimerEvent(*this);
++       parent->GetEventHandler()->QueueEvent(event);
++     }
+      TrackPanel *parent;
+    } mTimer;
+ 
diff -Nru audacity-2.0.6/debian/patches/wxwidgets-effect-dialogs-segfault.patch audacity-2.0.6/debian/patches/wxwidgets-effect-dialogs-segfault.patch
--- audacity-2.0.6/debian/patches/wxwidgets-effect-dialogs-segfault.patch	1970-01-01 01:00:00.000000000 +0100
+++ audacity-2.0.6/debian/patches/wxwidgets-effect-dialogs-segfault.patch	2014-10-25 16:49:33.000000000 +0200
@@ -0,0 +1,34 @@
+Description: Fix effect dialog segfault due to events before initialization
+ Both the LV2EffectDialog and the VampEffectDialog receive EVT_TEXT events
+ before they are properly initialized. To prevent this, a workaround was
+ already in place, but was only active on Windows. Activated the workaround
+ for wxGTK with wxWidgets >= 3.0, too.
+Author: Martin Steghöfer <martin at steghoefer.eu>
+Bug-Debian: http://bugs.debian.org/765341
+
+--- audacity-2.0.6.orig/src/effects/lv2/LV2Effect.cpp
++++ audacity-2.0.6/src/effects/lv2/LV2Effect.cpp
+@@ -913,8 +913,8 @@ LV2EffectDialog::LV2EffectDialog(LV2Effe
+    mLength(length)
+ {
+ 
+-#if defined(__WXMSW__)
+-   // On Windows, for some reason, wxWindows calls OnTextCtrl during creation
++#if defined(__WXMSW__) || (defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0))
++   // On Windows and GTK (with wx3.0), wxWidgets calls OnTextCtrl during creation
+    // of the text control, and LV2EffectDialog::OnTextCtrl calls HandleText,
+    // which assumes all the mFields have been initialized.
+    // This can give us a bad pointer crash, so manipulate inSlider to
+--- audacity-2.0.6.orig/src/effects/vamp/VampEffect.cpp
++++ audacity-2.0.6/src/effects/vamp/VampEffect.cpp
+@@ -333,8 +333,8 @@ VampEffectDialog::VampEffectDialog(VampE
+ 
+    mParameters = plugin->getParameterDescriptors();
+ 
+-#ifdef __WXMSW__
+-   // On Windows, for some reason, wxWidgets calls OnTextCtrl during creation
++#if defined(__WXMSW__) || (defined(__WXGTK__) && wxCHECK_VERSION(3, 0, 0))
++   // On Windows and GTK (with wx3.0), wxWidgets calls OnTextCtrl during creation
+    // of the text control, and VampEffectDialog::OnTextCtrl calls HandleText,
+    // which assumes all the fields have been initialized.
+    // This can give us a bad pointer crash, so manipulate inSlider to


More information about the pkg-multimedia-maintainers mailing list