Visit Jeremy's Blog.
Go Back > Blogs > rainbowsally
User Name


Rate this Entry

stupid self-fullfilling assumptions about "normal users"

Posted 04-26-2012 at 12:30 PM by rainbowsally
Updated 08-06-2014 at 10:18 AM by rainbowsally

To whom it may concern.
re. QT GuitarTuner bug fix.

The 'ptr' that was causing the problem was apparently the main app, not the GuitarTuner. You can stop reading here, if this makes sense to you.

But if you want to check out the guitar tuner here's a bit more info and a link to the build sources at the bottom.

Check for missing deps.

int main(int argc, char** argv)
  return 0;
Create a generic c++ tempate
mc2 -t c++ dummy
edit the mc2.def file
OUTNAME = dummy

# list of development libs (*.so)
  -lQtGui \
  -lQtCore \
  -lQtDeclarative \
  -lQtScript \
  -lQtSvg \
  -lQtSql \
  -lQtXmlPatterns \
  -lQtNetwork \
  -lpthread \
  -lQtMultimedia \
  -lstdc++ \
  -lm \
  -lgcc_s \
  -lc \
  -lglib-2.0 \
  -lpng14 \
  -lz \
  -lfreetype \
  -lgobject-2.0 \
  -lSM \
  -lICE \
  -lXi \
  -lXrender \
  -lXrandr \
  -lXfixes \
  -lXcursor \
  -lXinerama \
  -lfontconfig \
  -lXext \
  -lX11 \
  -ldl \
  -lgthread-2.0 \
  -lrt \
  -lasound \
  -lpcre \
  -luuid \
  -lxcb \
  -lXau \

# list of non-development libs or where more than one lib
# may exist (*.so.ver) requiring the full path
  /lib/ \
mc2 -init   # or mc2 -update if the -init switch isn't implemented 
            # in your version mc2, it does the same thing
If all of the dependencies are resolved, or can be by using the non-development versions, this guitar tuner should compile.

The problem:

Sometimes it segfaulted when you closed it. Not all the time. This suggests a race condition between threads.

void QMetaObject::removeGuard(QObject **ptr)
  if (!*ptr) // when the object at ptr is null it exits cleanly 
    return;  // but sometimes it has an object pointer and then 
             // it segfaults.  This occurs when it tries to cleanup 
             // the main app.
By making the main app a pointer and making the pointer static in main() the race condition that causes this crash can apparently be eliminated (because if the stack has collapsed the pointer will still be good).

So then here's 'main()' for guitartuner.
#include <QtGui/QApplication>
#include "guitartuner.h"

void dbg(){}

int main(int argc, char *argv[])
  static QApplication* a = new QApplication(argc, argv);
  GuitarTuner w;
  #ifdef Q_OS_SYMBIAN
  #elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
  int err = a->exec();
  printf("Looking for segfault -rs\n");
  return err;

It's about half a meg and doesn't appear to actually require the mobile libs. I also changed some "qrc:" paths, but if the rest of the original worked for you before, don't use my modifications, just check out the main() changes.

I leave you with this question. How long ago would that application have been debugged if QT, KDE, Kubuntu, openSUSE and others not made it so hard for us to compile stuff for our systems.

The code is fantastic. But the trend towards a Windows-like "hands off" philosopy with the accompanying dependency on sometimes ill-conceived automatic tools, stupid self-fulfilling assumptions about "normal users" and the difficulty of getting into these apps to play with them is what's deplorable in alleged 'open source'.

T/F? _______

--The Computer Mad Science Team

PS. If you aren't interested in my rant but would like to play with the GuitarTuner, it works! :-)
Posted in Uncategorized
Views 426 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 11:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration