[Fwd: Patch for crash with multiple UIs]
Ralf Engels <[email protected]>
| Newsgroups | gmane.comp.audio.zinf.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
the following patch solves a problem when specifying multiple UIs on the
command line.
Segmentation fault because of this line:
- name = m_argUIList[uiListIndex+1];
I did also a little cleanup on this file.
As my patches get more and bigger I have problems with diff.
Can you please tell me how to do the diff against the cvs? I know that
there is a mode for this.
Ok, anyway, here is the patch...
--- base/src/player.cpp.old 2003-07-27 19:48:37.000000000 +0200
+++ base/src/player.cpp 2003-07-27 20:00:37.000000000 +0200
@@ -657,7 +657,6 @@
Player::
Run()
{
- uint32_t uiListIndex = 0;
string name;
Error error = kError_NoErr;
int32_t uisActivated = 0;
@@ -686,6 +685,7 @@
bool loadSecondaryUIs = true;
// which ui should we instantiate first??
+ // todo: simplify this logic (Ralf)
if (m_argUIList.size() == 0)
{
const char *pref = kUIPref;
@@ -707,10 +707,8 @@
}
#endif
#endif
- }
- else
- {
- name = m_argUIList[uiListIndex++];
+
+ m_argUIList.push_back(name);
}
// at this point add in any extra UIs that might be wanted
@@ -766,13 +764,19 @@
if (IsntError(error))
{
- do {
- RegistryItem *item = NULL;
+
+ for( uint32_t uiListIndex = 0;
+ uiListIndex < m_argUIList.size();
+ uiListIndex++ )
+ {
+ name = m_argUIList[uiListIndex];
+
// UserInterface *ui = NULL;
- int32_t i = 0;
- while (NULL != (item = m_uiRegistry->GetItem(i++)))
+ for( int32_t i = 0; m_uiRegistry->GetItem(i) != NULL; i++ )
{
+ RegistryItem *item = m_uiRegistry->GetItem(i);
+
if (!CompareNames(item->Name(), downloadName.c_str()) &&
loadSecondaryUIs)
{
m_ui = (UserInterface *) item->InitFunction()(m_context);
@@ -842,13 +846,8 @@
}
// break; Don't think this'll work now...
}
- }
-
- if(uiListIndex < m_argUIList.size())
- {
- name = m_argUIList[uiListIndex+1];
- }
- } while (uiListIndex++ < m_argUIList.size());
+ } // while
+ } // for each UI
if (!uisActivated)
{
player.patch
(text/plain, 1.8 KB)
--- base/src/player.cpp.old 2003-07-27 19:48:37.000000000 +0200
+++ base/src/player.cpp 2003-07-27 20:00:37.000000000 +0200
@@ -657,7 +657,6 @@
Player::
Run()
{
- uint32_t uiListIndex = 0;
string name;
Error error = kError_NoErr;
int32_t uisActivated = 0;
@@ -686,6 +685,7 @@
bool loadSecondaryUIs = true;
// which ui should we instantiate first??
+ // todo: simplify this logic (Ralf)
if (m_argUIList.size() == 0)
{
const char *pref = kUIPref;
@@ -707,10 +707,8 @@
}
#endif
#endif
- }
- else
- {
- name = m_argUIList[uiListIndex++];
+
+ m_argUIList.push_back(name);
}
// at this point add in any extra UIs that might be wanted
@@ -766,13 +764,19 @@
if (IsntError(error))
{
- do {
- RegistryItem *item = NULL;
+
+ for( uint32_t uiListIndex = 0;
+ uiListIndex < m_argUIList.size();
+ uiListIndex++ )
+ {
+ name = m_argUIList[uiListIndex];
+
// UserInterface *ui = NULL;
- int32_t i = 0;
- while (NULL != (item = m_uiRegistry->GetItem(i++)))
+ for( int32_t i = 0; m_uiRegistry->GetItem(i) != NULL; i++ )
{
+ RegistryItem *item = m_uiRegistry->GetItem(i);
+
if (!CompareNames(item->Name(), downloadName.c_str()) && loadSecondaryUIs)
{
m_ui = (UserInterface *) item->InitFunction()(m_context);
@@ -842,13 +846,8 @@
}
// break; Don't think this'll work now...
}
- }
-
- if(uiListIndex < m_argUIList.size())
- {
- name = m_argUIList[uiListIndex+1];
- }
- } while (uiListIndex++ < m_argUIList.size());
+ } // while
+ } // for each UI
if (!uisActivated)
{