Andreas Rottmann | 19 Jul 20:01
Picon
Picon
Gravatar

[Ralf Engels] zinf musicbrowser.cpp


This looks reasonable to me. Thoughts?

Picon Picon
From: Ralf Engels <ralf-engels <at> gmx.de>
Subject: zinf musicbrowser.cpp
Date: 2003-07-18 20:39:10 GMT
    Hi,
I compiled the CVS version from 17-July and got a segmentation fault 
which could be tracked to musicbrowser.cpp

When I started zinf I got the message:
"Parsing the Theme description failed: ..."
The error is probably connected to my old freeamp installation.

However afterwards I got the segmentation fault in 
MuiscBrowserUI::AcceptEvents on the line
delete mainBrowser

I am not sure what exactly the error was because the stack got corrupted.
However the attached patch solves the issue.

Could you please check my correction and check the changes in.

Thanks,
Ralf
--- musicbrowser.cpp.old	2003-07-18 22:22:14.000000000 +0200
+++ musicbrowser.cpp	2003-07-18 22:27:42.000000000 +0200
@@ -45,13 +45,23 @@

 MusicBrowserUI::MusicBrowserUI(FAContext *context)
 {
+    // important, initialize all class variables every time!
+    // m_playerEQ
     m_context = context;
-    searching = NULL;
+    isVisible = false;
+    m_propManager = NULL;
+    m_startupType = 0;
+    m_initialized = false;
+    mainBrowser = NULL;
+    // browserWindows
     wiz = NULL;
+    searching = NULL;
 }

 MusicBrowserUI::~MusicBrowserUI()
 {
+  if( mainBrowser )
+    delete mainBrowser;
 }

 Error MusicBrowserUI::Init(int32_t startup_level) 
@@ -80,7 +90,6 @@
     switch (event->Type()) {
         case CMD_Cleanup: {
             mainBrowser->Close(false);
-            delete mainBrowser;

             while (browserWindows.size() > 0) {
                 browserWindows[0]->Close(false);

Regards, Andy
--

-- 
Andreas Rottmann         | Rotty <at> ICQ      | 118634484 <at> ICQ | a.rottmann <at> gmx.at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Latein ist das humanoide Äquivalent zu Fortran.
   -- Alexander Bartolich in at.linux

Gmane