El 21/10/14 a les 14:13, Klaumi Klingsporn ha escrit:
sorry for the late answer

No need to apologize, you've been a great help so far!


El 21/10/14 a les 16:10, Klaumi Klingsporn ha escrit:
and I also added the
configure flag '--with-lv2=system' to Debian/rules

...which I think is a good idea, independently of the current problems. I'd suggest that the package maintainers do the same, if there is no specific reason not to.

In audacity-2.0.6/src/effects/lv2/LV2Effect.cpp I found your comment
from the wxWidgets-3.patch:
"   // wxWidgets calls OnTextCtrl during creation
    // of the text control, and LadspaEffectDialog::OnTextCtrl calls
HandleText,
    // which assumes all the fields have been initialized.
    // This can give us a bad pointer crash, so manipulate inSlider to
    // no-op HandleText during creation. "

This is already very close. :-)

But actually the comment wasn't added by my wxWidgets patch, but was there before. And it's not the problem, but the solution. It's a workaround that has been in several effect dialogs to avoid a crash on Windows. Starting from wxWidgets 3.0 this workaround is necessary for GTK, too. In fact, the wxWidgets patch already activated it for the LadspaEffectDialog, but neither for the VampEffectDialog nor the LV2EffectDialog.

The attached patch (wxwidgets-effect-dialogs-segfault.patch) now does it for those, too. Again, I also re-attached the patches for the other problems you mentioned in this report.

Cheers,
Martin

P.S.: Depending on the plugin parameters, those LV2 dialogs look really ugly (empty space in weird places, empty boxes,...). But that's something unrelated to the library upgrade and has to be improved for the next upstream version, not in this Debian bug.


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 <[email protected]>
Forwarded: [email protected], 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();
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 <[email protected]>
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;
 
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 <[email protected]>
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

Reply via email to