[En-Nut-Discussion] Optimizing nutconf

"Jörg Hermann" jhermann at gmx.net
Mon Jan 12 11:48:11 CET 2009


Hi all,
I just investigate the same issue, and after some debugging found 
the root cause for the seg fault.
On closing the 'open file' dialog, the destructor tries to find the 
top level parent window of the dialog and wants to invoke an
operation on that object. For some reason I don't quite understand, 
it assumes the splash screen to be the top level parent. Unfortunately
this window has been destructed in the meantime, which leads to
the seg fault.
This is the workaround, I have introduced, let me know if this works
for you as well.
best regards, 
Joerg

diff -b -U3 -r1.18 nutconf.cpp
--- tools/nutconf/nutconf.cpp    18 Sep 2008 09:53:22 -0000    1.18
+++ tools/nutconf/nutconf.cpp    16 Dec 2008 11:26:15 -0000
@@ -166,11 +166,20 @@
      * Splash display.
      */
     wxBitmap bmp(wxBITMAP(SSB_NUTCONF));
-    wxSplashScreen* splash = new wxSplashScreen(bmp, 
wxSPLASH_CENTRE_ON_SCREEN, 0, NULL, -1);
-    for (int i = 0; i < 5; i++) {
+    wxSplashScreen* splash = new wxSplashScreen(bmp,
+          wxSPLASH_CENTRE_ON_SCREEN,
+          0, NULL, -1, wxDefaultPosition, wxDefaultSize,
+          wxSIMPLE_BORDER|wxSTAY_ON_TOP);
+//     wxSplashScreen* splash = new wxSplashScreen(bmp,
+//           wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
+//           6000, NULL, -1, wxDefaultPosition, wxDefaultSize,
+//           wxSIMPLE_BORDER|wxSTAY_ON_TOP);
         wxYield();
-        wxMilliSleep(100);
-    }
+
+//     for (int i = 0; i < 5; i++) {
+//         wxYield();
+//         wxMilliSleep(100);
+//     }
 
     wxImage::AddHandler(new wxGIFHandler);
     wxImage::AddHandler(new wxPNGHandler);
@@ -213,10 +222,6 @@
     SetTopWindow(m_mainFrame);
     m_mainFrame->Show();
 
-    if(splash) {
-        splash->Destroy();
-    }
-
     if 
(!m_mainFrame->GetHelpController().Initialize(wxT("nutoshelp"))) {
         wxLogMessage(wxT("Failed to load help file"));
     }
@@ -254,6 +259,10 @@
      */
     m_docManager->CreateDocument(m_settings->m_configname, 0);
 
+    if(splash) {
+        splash->Destroy();
+    }
+
     return true;
 }
 

>             
> -------- Original-Nachricht --------
> Datum: Mon, 12 Jan 2009 02:04:50 +0100
> Von: Ole Reinhardt <ole.reinhardt at embedded-it.de>
> An: "Ethernut User Chat (English)" <en-nut-discussion at egnite.de>
> Betreff: Re: [En-Nut-Discussion] Optimizing nutconf
> 
>             Hi,
> 
> > > I just build the HEAD version of NutConf on my Ubuntu 8.10 machine 
> and
> > > tried to reproduce your problems. Unfortunately I ended up in a
> > > segmentation fault just after selecting a configuration file. So it 
> does
> > > not work at all for me.
> > 
> > Ole, are you running KDE4? There seems to be a problem with this KDE
> > version and the wxWidget file open dialog. Last time I googled for 
> that,
> > only very few reports about this issue appeared and no solution...
> 
> No, I use Gnome 2.24. I did not track down the problem yet, but I'll do
> the next days. GDB will help me, I'm shure :)
> 
> > IMHO it is not allowed to have both, a pure-specifier and the
> > definition. Although, the MS compiler accepted that statement. Do we
> > need the  declaration of the destructor at all?
> > 
> > I should add, that my knowledge about C++ is not sufficient to
> > understand all the details. After removing the destructor, it seems to
> > work, but I'm not sure whether this may break something else.
> 
> Hmm... me I'm not a C++ guru either... so perhaps Thiago has an idea
> himself?
> 
> Regards,
> 
> Ole
> 
> -- 
>  _____________________________________________________________
> |                                                             |
> | Embedded-IT          Hard- und Softwarelösungen             |
> |                                                             |
> | Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
> | Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
> | 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
> | Germany              Web:         http://www.embedded-it.de |
> |                      UstID / VAT:       DE198944716         |
> |_____________________________________________________________|
> 
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
> 
        
-- 
Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a



More information about the En-Nut-Discussion mailing list