[En-Nut-Discussion] Optimizing nutconf

Thiago A. Corrêa thiago.correa at gmail.com
Wed Jan 14 00:35:52 CET 2009


On Tue, Jan 13, 2009 at 7:12 PM, Ole Reinhardt
<ole.reinhardt at embedded-it.de> wrote:
> Hi Jörg,
>
>> I will re-post the patch as attachment (maybe someone else also
>> wants to give it a try...), but I unfortunately cannot do this berfore
>> Thursday evening, since I'm travelling and I have the patch on my
>> PC at home only.
>
> Harald forwarded me your mail directly again and there the mail body was
> intact, so I could extract your patch.
>
> For me too, this patch fixes the segmentation fault and nutconf works.
> >From the C++ / WXwidgets side of view I don't have an opinion to your
> patch since I'm no WX nor a C++ expert. If you and others don't have any
> objections I could checkin the patch to CVS.
>

I would like to offer a few comments.


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);



Looks great, but I guess we should loose the commented out lines,
that's what we have CVS for :)
Removing the loop might get it to show for a bit less time, but that's
quite aestetic.

[snip]
+    if(splash) {
+        splash->Destroy();
+    }
+
     return true;
 }

I know you just moved this block, but unless wxSplashScreen::Destroy()
commits suicide ( delete this ), this will leak memory. If it's
destructor calls Destroy, you can just delete it:

delete splash;

 No if checking is necessary, because in C++ it's safe to delete 0;

Kind Regards,
    Thiago A. Correa



More information about the En-Nut-Discussion mailing list