Quantcast

Linux OverlayPanel bug

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Linux OverlayPanel bug

Darrell Walisser
I have been having this for while and assumed it was the oddity of my system setup. I use LXDE with compositor disabled, on  Ubuntu 16.04, which is a bit unusual.

The assert (see trace below) happens frequently when starting audacity or closing a project, but not always. It happens just before the project window is shown, or in the process of being shown for the first time.

The first time time OverlayPanel::DrawOverlays is called, pDC is null, so wxClientDC is created. However, dc.IsOk() will return true and yet dc.GetHandle() will return null, leading to the assert fail shortly after. The rest of the time, pDC is not null and there is no error. 

Assuming the client dc is in fact not ready to do anything, I arrived at the following patch. I'm not familiar enough with wxWidgets to know if this is the best fix.

diff --git a/src/widgets/OverlayPanel.cpp b/src/widgets/OverlayPanel.cpp
index bbd5e2d..cbb7053 100644
--- a/src/widgets/OverlayPanel.cpp
+++ b/src/widgets/OverlayPanel.cpp
@@ -84,6 +84,10 @@ void OverlayPanel::DrawOverlays(bool repaint_all, wxDC *pDC)
    Maybe<wxClientDC> myDC;
    auto &dc = pDC ? *pDC : (myDC.create(this), *myDC);
 
+   // Somehow this can be null, maybe just before project window is realized
+   if (!dc.GetHandle())
+      return;
+
    // Erase
    bool done = true;
    auto it2 = pairs.begin();





---
ASSERT INFO:
../src/gtk/dcclient.cpp(2043): assert "m_window" failed in DoGetSize(): GetSize() doesn't work without window

BACKTRACE:
[1] wxClientDCImpl::DoGetSize(int*, int*) const
[2] wxRect::wxRect(wxSize const&) /usr/include/wx-3.0/wx/gdicmn.h:710
[3] OverlayPanel::DrawOverlays(bool, wxDC*) /home/ghaxt/sw/audacity/src/widgets/OverlayPanel.cpp:100
[4] TrackPanel::OnTimer(wxTimerEvent&) /home/ghaxt/sw/audacity/src/TrackPanel.cpp:972
[5] wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
[6] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[7] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[8] wxEvtHandler::TryHereOnly(wxEvent&)
[9] wxEvtHandler::ProcessEventLocally(wxEvent&)
[10] wxEvtHandler::ProcessEvent(wxEvent&)
[11] wxEvtHandler::ProcessPendingEvents()
[12] wxAppConsoleBase::ProcessPendingEvents()
[13] wxApp::DoIdle()
[14] g_main_context_dispatch
[15] g_main_loop_run
[16] gtk_main
[17] wxGUIEventLoop::DoRun()
[18] wxEventLoopBase::Run()
[19] wxAppConsoleBase::MainLoop()
[20] wxEntry(int&, wchar_t**)
[21] main /home/ghaxt/sw/audacity/src/AudacityApp.cpp:726
[22] __libc_start_main
[23] _start



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linux OverlayPanel bug

Darrell Walisser
​I found an alternate solution by deferring the timer start in TrackPanel until the window is shown.​ This Binds() the wxEVT_SHOW on TrackPanel to trigger the timer, then it Unbinds() as its no longer needed. So at least the nature of the bug is a bit better defined. wxShowEvent() is not a great idea since the docs say its only available on MSW and GTK versions.

As its not a priority right now, I'll submit a bug and we can go from there.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linux OverlayPanel bug

Darrell Walisser
​Not a new bug after all, I didn't think to search until now. I'll be commenting there.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Linux OverlayPanel bug

James Crook
In reply to this post by Darrell Walisser
On 2/24/2017 9:29 PM, Darrell Walisser wrote:
> ​I found an alternate solution by deferring the timer start in TrackPanel
> until the window is shown.​ This Binds() the wxEVT_SHOW on TrackPanel to
> trigger the timer, then it Unbinds() as its no longer needed. So at least
> the nature of the bug is a bit better defined. wxShowEvent() is not a great
> idea since the docs say its only available on MSW and GTK versions.
>
> As its not a priority right now, I'll submit a bug and we can go from there.
>
Belay that.  It IS a priority for 2.1.3 RC3 now.  With you having it
reproducible (none of us did), it is both more serious - and more fixable.
Anything wrong with using IsShownOnScreen()?

Whatever, very glad to have your 'overlay panel bug' related to 1401.

> ​Not a new bug after all, I didn't think to search until now. I'll be
> commenting there.

--James.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Loading...