[mythtv-users] Re: mythbrowser 0.18
Paul
mythtv at dsl.pipex.com
Tue May 3 10:21:18 UTC 2005
>Hi All,
>I've been trying to debug the mythbrowser 0.18 segmentation
>violation. I've been using gdb, here is where the problem
>starts:
>Breakpoint 2, main (argc=2, argv=0xbffff684) at main.cpp:78
>78 KApplication a(argc,argv);
>(gdb) s
>Program received signal SIGSEGV, Segmentation fault.
>0x41161569 in KCmdLineArgs::count () from /usr/kde/3.2/lib/libkdecore.so.4
>KApplication is allocating "a" and thus calling it's constructor. The
>constructor seems unhappy.
>To be honest I suspected this was a problem with outdated libraries. I
>have a fairly out of date gentoo system. Here's the output of
>kde-config:
>spug mythbrowser # kde-config --version
>Qt: 3.3.3
>KDE: 3.2.2
>kde-config: 1.0
>Then I decided to compare mythbrowser 0.18 with 0.17 and found that
>the way the command line arguments are being initialised has changed:
>KCmdLineArgs::init(argc, argv, "mythbrowser", usage , version);
>Had become:
>KCmdLineArgs::init(argc, argv, "mythbrowser", "mythbrowser", usage ,
>version);
>In mythbrowser 0.18.
>I simply changed this back and all started working again.
>Hope this helps...
>Cheers,
>Doug Scoular
Thanks Doug. I think we are making some progress now :-)
It looks like we're exposing a bug in the kde3.2.x version of KCmdLineArgs
to me. I use 3.3.0 and 3.3.1 and it works fine.
I changed the call to KCmdLineArgs::init because the old call kept
producing a compiler warning about 'init' is deprecated or something
similar.
Because I can't reproduce the problem here it is not possible for me to
debug it.
If you have the time there is a few things you could try to track the
problem
down.
Its a long shot but I wonder if the compiler is getting confused about
which
init call to use. Though I can't see how that could be.
Could you try changing it to this and try again.:-
KCmdLineArgs::init(argc, argv, "mythbrowser", "mythbrowser", usage, version,
false);
That should remove any ambiguity about which call to use for the compiler.
Another thing I noticed looking at the code is the order in which the
arguments are
parsed and the creation of the KApplication object looks back to front to
me.
Move 'KApplication a(argc, argv)' to just after
'KCmdLineArgs::addCmdLineOptions(options)'
and before KCmdLineArgs * args = KCmdLineArgs::parsedArgs();
so it looks something like this:-
KCmdLineArgs::init(argc, argv, "mythbrowser", "mythbrowser", usage, version,
false);
KCmdLineArgs::addCmdLineOptions(options);
KApplication a(argc, argv);
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
That looks more like the example code in the KDE docs. In fact I don't think
we need to pass the arguments to KApplication at all and just replace
KApplication a(argc, argv) with KApplication a;
Thanks for your time.
Paul
More information about the mythtv-users
mailing list