wxSplashScreen Crash

77 views
Skip to first unread message

highpet

unread,
May 22, 2012, 3:53:35 AM5/22/12
to wx-u...@googlegroups.com
Hi,guys.

I look up wxWidgets Samples about usage of Class "wxSplashScreen". I found it crashs when there is one more splashscreen frames.


====Original in wxWidgets-2.9.3\Samples\splash\splash.cpp========
...
if (ok)
    {
        new wxSplashScreen(bitmap,
            wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
            6000, frame, wxID_ANY, wxDefaultPosition, wxDefaultSize,
            wxSIMPLE_BORDER|wxSTAY_ON_TOP);
   }
...

===I add new line in wxWidgets-2.9.3\Samples\splash\splash.cpp======
.....
if (ok)
    {
        new wxSplashScreen(bitmap,
            wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
            6000, frame, wxID_ANY, wxDefaultPosition, wxDefaultSize,
            wxSIMPLE_BORDER|wxSTAY_ON_TOP);

        new wxSplashScreen(bitmap,
            wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
            6000, frame, wxID_ANY, wxDefaultPosition, wxDefaultSize,
            wxSIMPLE_BORDER|wxSTAY_ON_TOP);
    }
...
=========

AFAIK,wxSplashScreen destroy itself with code:

=========wxWidgets-2.9.3\src\generic\splash.cpp line 103===
wxSplashScreen::~wxSplashScreen()
{
    m_timer.Stop();

    wxEvtHandler::RemoveFilter(this);
}

The first splash use wxEvtHandler::RemoveFilter(this) remove all objects of ms_filterList static linked list. The second can't destroy self properly. So detroy splash manually can not work.

Then if i want to use multiple splash windows, how to solve it gracefully?

Vadim Zeitlin

unread,
May 22, 2012, 5:53:59 AM5/22/12
to wx-u...@googlegroups.com
On Tue, 22 May 2012 00:53:35 -0700 (PDT) highpet wrote:

h> I look up wxWidgets Samples about usage of Class "wxSplashScreen". I found
h> it crashs when there is one more splashscreen frames.

I can't reproduce the problem under MSW with this patch to the sample:

diff --git a/samples/splash/splash.cpp b/samples/splash/splash.cpp
index 79014bd..856d34e 100644
--- a/samples/splash/splash.cpp
+++ b/samples/splash/splash.cpp
@@ -146,6 +146,10 @@ bool MyApp::OnInit()
wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
6000, frame, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxSIMPLE_BORDER|wxSTAY_ON_TOP);
+ new wxSplashScreen(bitmap,
+ wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
+ 6000, frame, wxID_ANY, wxDefaultPosition, wxDefaultSize,
+ wxSIMPLE_BORDER|wxSTAY_ON_TOP);
}

#if !defined(__WXGTK20__)


Whether I click the splash screen or let it expire on its own, no crash
happens. What exactly do I need to do to provoke it? Also, under which
platform did you test? And what is the stack trace at the moment of the
crash?

h> AFAIK,wxSplashScreen destroy itself with code:
h>
h> =========wxWidgets-2.9.3\src\generic\splash.cpp line 103===
h> wxSplashScreen::~wxSplashScreen()
h> {
h> m_timer.Stop();
h>
h> wxEvtHandler::RemoveFilter(this);
h> }

Yes, this is correct.

h> The first splash use wxEvtHandler::RemoveFilter(this) remove all objects of
h> ms_filterList static linked list.

I don't understand why would this happen though. RemoveFilter(this)
removes just this object itself from the list of the filters, why do you
think that it removes all of them?

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

highpet

unread,
May 22, 2012, 10:19:45 AM5/22/12
to wx-users
>  I can't reproduce the problem under MSW with this patch to the sample:

Then do this:
run the sample splash, click 'help'--'about' as splash startup. Do
nothing....

==
I pop up "wxWidgets Debug Alert" Dialog.

highpet

unread,
May 22, 2012, 10:29:48 AM5/22/12
to wx-users
>  I can't reproduce the problem under MSW with this patch to the sample:

or do this:
run the sample splash, close mainframe quickly as splash startup. Do
nothing....

==
also pop up "wxWidgets Debug Alert" Dialog.

highpet

unread,
May 22, 2012, 10:53:56 AM5/22/12
to wx-users
>  I don't understand why would this happen though. RemoveFilter(this)
> removes just this object itself from the list of the filters, why do you
> think that it removes all of them?

My fault description , maybe!

If wxSplashScreen is a child windows of a frame and if parent frame
destroy first, wxSplashScreen can not destroy itself.

Vadim Zeitlin

unread,
May 23, 2012, 8:12:34 AM5/23/12
to wx-u...@googlegroups.com
On Tue, 22 May 2012 07:19:45 -0700 (PDT) highpet wrote:

h> >  I can't reproduce the problem under MSW with this patch to the sample:
h>
h> Then do this: run the sample splash, click 'help'--'about' as splash
h> startup. Do nothing....
h>
h> ==
h> I pop up "wxWidgets Debug Alert" Dialog.

I don't get it... Did you use unmodified sample for this (because your
initial modification doesn't affect the splash screen shown by "About" at
all)?

h> or do this: run the sample splash, close mainframe quickly as splash
h> startup. Do nothing....
h>
h> ==
h> also pop up "wxWidgets Debug Alert" Dialog.

Unfortunately I don't see this neither.


Please retest with the latest wx sources from svn and if you can still any
of these bugs please report them with as many details as possible, i.e.:

0. Your platform (and wx version but this should be "trunk").
1. Any changes (in the form of a patch) to the sample you did.
2. The exact sequence of user actions needed to reproduce the bug.
3. The information from the assert dialog box.
4. The stack trace from the debugger when the assert happens.

Thanks,

Eric Jensen

unread,
May 23, 2012, 9:03:33 AM5/23/12
to Vadim Zeitlin
Hello Vadim,

Wednesday, May 23, 2012, 2:12:34 PM, you wrote:

VZ> Please retest with the latest wx sources from svn and if you can still any
VZ> of these bugs please report them with as many details as possible, i.e.:

I see it too.

wx trunk.
unmodified "splash" sample.

- start the sample
- do *not* click into the big splashscreen to make it disappear
- instead select "help -> about" from the menu
- use Close icon of the main frame to terminate the application

The assert will be in wxEvtHandler::RemoveFilter() "Filter not found"

Hth
Eric


splash_sample_callstack.txt

Eric Jensen

unread,
May 23, 2012, 9:05:28 AM5/23/12
to wx-u...@googlegroups.com
Hello Eric,

Wednesday, May 23, 2012, 3:03:33 PM, you wrote:

EJ> Hello Vadim,

EJ> Wednesday, May 23, 2012, 2:12:34 PM, you wrote:

VZ>> Please retest with the latest wx sources from svn and if you can still any
VZ>> of these bugs please report them with as many details as possible, i.e.:

EJ> I see it too.

EJ> wx trunk.
EJ> unmodified "splash" sample.

EJ> - start the sample
EJ> - do *not* click into the big splashscreen to make it disappear
EJ> - instead select "help -> about" from the menu
EJ> - use Close icon of the main frame to terminate the application

EJ> The assert will be in wxEvtHandler::RemoveFilter() "Filter not found"

EJ> Hth
EJ> Eric

Sorry, forgot to mention:
Windows XP, VS2005, standard setup.h, Debug build

I am using statically linked CRTs though, but i don't think that makes
any difference.

Eric


Vadim Zeitlin

unread,
May 23, 2012, 4:36:13 PM5/23/12
to wx-u...@googlegroups.com
On Wed, 23 May 2012 15:03:33 +0200 Eric Jensen wrote:

EJ> VZ> Please retest with the latest wx sources from svn and if you can still any
EJ> VZ> of these bugs please report them with as many details as possible, i.e.:
EJ>
EJ> I see it too.
EJ>
EJ> wx trunk.
EJ> unmodified "splash" sample.
EJ>
EJ> - start the sample
EJ> - do not click into the big splashscreen to make it disappear
EJ> - instead select "help -> about" from the menu
EJ> - use Close icon of the main frame to terminate the application

I see it too now, thanks.

EJ> The assert will be in wxEvtHandler::RemoveFilter() "Filter not found"

And now that I convinced myself that the bug was really there it's trivial
to see why, too: I managed to forget to update the previous node pointer in
the linked list node removal code. Really embarrassing but fixed now in
r71538, thanks!

highpet

unread,
May 24, 2012, 11:44:58 PM5/24/12
to wx-users
Good job! Now all works fine.

Thanks to all.
Reply all
Reply to author
Forward
0 new messages