remove_static_iterator.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. diff --git a/src/core/Main.cc b/src/core/Main.cc
  2. index c170e63..b6fa5f1 100644
  3. --- a/src/core/Main.cc
  4. +++ b/src/core/Main.cc
  5. @@ -18,7 +18,6 @@
  6. static size_t configitems;
  7. static unsigned int taskbar;
  8. static std::list<App *> list;
  9. -static std::list<App *>::iterator it;
  10. static App *p;
  11. static Bar *barra;
  12. @@ -69,8 +68,7 @@ int main(int argc, char **argv)
  13. if (list.size() != 0)
  14. {
  15. - it = list.begin();
  16. - p = (*it);
  17. + p = *list.begin();
  18. }
  19. else
  20. {
  21. @@ -440,7 +438,6 @@ int mapIcons()
  22. {
  23. list.pop_back();
  24. ((SuperBar *)barra)->removeIcon();
  25. - it--;
  26. }
  27. // add currently running tasks to the list
  28. if ( (taskbar) &&
  29. @@ -481,15 +478,17 @@ int mapIcons()
  30. }
  31. }
  32. }
  33. - //if this is not an initial run
  34. - if (!firstrun)
  35. - // and we added no windows
  36. - if ((size_t)list.size() == configitems)
  37. - //then there is no need to add icons
  38. +
  39. + // if this is not an initial run and we added no windows
  40. + // then there is no need to add icons
  41. + if (!firstrun && (size_t)list.size() == configitems)
  42. return 0;
  43. - for (it++; it != list.end(); it++)
  44. +
  45. + std::list<App *>::iterator appsIt = list.begin();
  46. + while ((size_t)std::distance(list.begin(), ++appsIt) < configitems);
  47. + while (++appsIt != list.end())
  48. {
  49. - p = (*it);
  50. + p = *appsIt;
  51. try
  52. {
  53. if (p->getIconName() != "")
  54. @@ -518,8 +517,7 @@ int mapIcons()
  55. }
  56. (void) XSetErrorHandler(oldXHandler);
  57. barra->scale();
  58. - if (firstrun)
  59. - it--;
  60. +
  61. return 0;
  62. }