Hi Klaumi!
Regarding (1):
El 16/10/14 a les 23:53, Klaumi Klingsporn ha escrit:
You find a sample-project at:
https://www.dropbox.com/s/79d6p6sri6shlj5/sample-project.tgz?dl=0
Thanks, that sample project helped a lot to track down the problem! :-)
I identified the problem as a bug in wxWidgets 3.0. In order to fulfill
clipboard operations, they have to process GDK events. Unfortunately,
the processing isn't sufficiently protected and processes not only
clipboard events, but all kinds of stuff - like wxShowEvent and
wxTimerEvent, which in our case perform clipboard operations on their
own and cause the reentry.
If you want the details, you can find them in the upstream bug report I
filed:
http://trac.wxwidgets.org/ticket/16636
Actually the situation was even worse in wxWidgets 2.8: While in 3.0
they have a porous safety net in the event processing, in 2.8 they
didn't have any safety net at all. BUT:
* Audacity had its own safety net in place as a workaround - which,
however is now incompatible with wxWidgets' own safety net (they both
rely on changing the GDK event handler - whoever does the change later,
wins).
* The distribution of the clipboard operations (in which event they are
processed) in Audacity with 2.8 was more fortunate.
So I tried to work around this by shifting the moment of doing the event
processing that involves clipboard operations at a moment at which we
can be certain of not being in a YieldFor(..) call (and therefore not in
a clipboard operation executed before). I hope that I've covered all
dangerous processings, it's not easy to identify them. I've attached a
patch (wxwidgets-clipboard-reentry-workaround.patch) that works for me
with the audacity-2.0.6-1 package. Do you have the chance to try it? Or
do you want me to provide a binary package for you to try it or something?
3. Segmentation fault on applying LV2 plugins
[...]
Only an idea of an user-only: Maybe it has something to do with my
extra set configure-flag "--with-lv2=system".
I think there's a good chance that it's related to that. However, could
you be more specific about the LV2 plugin you tried and where it comes
from? The crash that I could produce turned out to be more related to
the LV2 plugin itself than audacity.
Cheers,
Martin
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 <mar...@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;