LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs > rainbowsally
User Name
Password

Notices

Rate this Entry

stupid self-fullfilling assumptions about "normal users"

Posted 04-26-2012 at 12:30 PM by rainbowsally
Updated 09-04-2013 at 10:14 PM 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.

Code:
int main(int argc, char** argv)
{
  return 0;
}
Create a generic c++ tempate
Code:
mc2 -t c++ dummy
edit the mc2.def file
Code:
OUTNAME = dummy
SRCDIR = .
<...>
LDFLAGS =  $(LIBSLIST) $(LIBSLIST_FULLPATH)

# list of development libs (*.so)
LIBSLIST = \
  -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
LIBSLIST_FULLPATH = \
  /lib/libexpat.so.1 \
  ###############
Code:
mc2 -init   # or mc2 -update if the -init switch isn't implemented 
            # in your version mc2, it does the same thing
make
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.

Code:
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.
Code:
#include <QtGui/QApplication>
#include "guitartuner.h"

void dbg(){}

int main(int argc, char *argv[])
{
  static QApplication* a = new QApplication(argc, argv);
  GuitarTuner w;
  w.setOrientation(GuitarTuner::LockPortrait);
  
  #ifdef Q_OS_SYMBIAN
  w.showFullScreen();
  #elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
  w.showMaximized();
  #else
  w.show();
  #endif
  
  int err = a->exec();
  printf("Looking for segfault -rs\n");
  dbg();
  return err;
}
http://rainbowsally.net/rainbowsally...artuner.tar.gz

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 255 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 12:29 PM.

Main Menu
Advertisement

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