Reply
Thread Tools
antman8969's Avatar
Posts: 64 | Thanked: 58 times | Joined on Jul 2010 @ United States
#1
Obviously they launch the application, but I have a feeling they do more behind the scenes.

I'm asking this because I'm developing an application and I'm stuck on an odd problem: I can launch my app in xterm with

Code:
$ /usr/bin/qtweather
and it runs perfectly. But when I try to use the .desktop file:


Code:
[Desktop Entry]
Encoding=UTF-8
Version=0.5
Type=Application
Name=qtweather
GenericName=qtweather
Exec=/usr/bin/qtweather
Icon=qtweather
X-Window-Icon=qtweather
X-HildonDesktop-ShowInToolbar=true
X-Osso-Type=application/x-executable
the app crashes in my slot that handles a network request from a QNetworkAccessManager.

There has to be something I'm not adding to the .desktop file that should be there, or else I have no explanation for that behavior...


EDIT: Also, I can compile the project and install it on my x86 emulator target in scratchbox and it works fine from the .desktop file...

Last edited by antman8969; 2011-02-21 at 05:53.
 
rooster13's Avatar
Posts: 319 | Thanked: 221 times | Joined on Jan 2010 @ Finland
#2
I guess u have to use dbus calls to launch apps from program.
I use dbus calls in my app Shortcut Stash and it works fine.

I read the EXEC parameter from the desktop file and launch the app using dbus.
__________________
Sail Raid, an old skool shoot'em up for Jolla
KillDroid, Android service killer for Jolla
goViihde, an Elisa Viihde client for Jolla
goViihde, an Elisa Viihde client for N9
Shortcut Stash Home Screen Widget
 
antman8969's Avatar
Posts: 64 | Thanked: 58 times | Joined on Jul 2010 @ United States
#3
Originally Posted by rooster13 View Post
I guess u have to use dbus calls to launch apps from program.
I use dbus calls in my app Shortcut Stash and it works fine.

I read the EXEC parameter from the desktop file and launch the app using dbus.
Hmm.... does that consist of just having a .services file that calls dbus and including that in the Unix{} section of your .pro file? Because if so, that made no difference for me...
 
rooster13's Avatar
Posts: 319 | Thanked: 221 times | Joined on Jan 2010 @ Finland
#4
What are you actually trying to do? I use dbus calls from Qt. Do a google search for Maemo dbus and you'll get lots of examples about it usages.

If u r using Qt check out my projects source code for an example how to launch apps with Qt using dbus.
__________________
Sail Raid, an old skool shoot'em up for Jolla
KillDroid, Android service killer for Jolla
goViihde, an Elisa Viihde client for Jolla
goViihde, an Elisa Viihde client for N9
Shortcut Stash Home Screen Widget
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#5
If you get a crash, your program is broken.

If I were to guess, and I am, the environment that you rely on to be in some special way is not when your application is started with the desktop semantics.

Dig into the connection code a bit more and handle all return values from whatever resource you're calling and I'm sure you'll figure it out.
 
antman8969's Avatar
Posts: 64 | Thanked: 58 times | Joined on Jul 2010 @ United States
#6
Originally Posted by Joorin View Post
If you get a crash, your program is broken.

If I were to guess, and I am, the environment that you rely on to be in some special way is not when your application is started with the desktop semantics.

Dig into the connection code a bit more and handle all return values from whatever resource you're calling and I'm sure you'll figure it out.
hmm... is there any documentation to assist me in this that you know of? It's my first Qt application, first Maemo application, and first Debian project so I'm kind of at a loss...

I do know that if I comment out one line of code, specifically one where I access a QList that I create from data returned by a QNetworkAccessManager, it doesn't crash...
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#7
If you access a container directly (but I'm only assuming you do) without first checking its length, you will end up with, in the best case, odd results or, as in this case, failure. Typically, using an iterator is the safer bet since you then get well defined situations if it's, for example, an empty container.

So, your call to the QNetworkAcessManager instance didn't behave as you expected it to. Check what resources this class relies on. How do you instantiate it? What call did you do?

In regards to documentation, I'm not more in the know than you. Qt is a framework with lots of interesting things in it and quite a few hidden dependencies that you need to understand. Have a thorough look at the Qt documentation for network connections and look at the examples (one more time) and try to find if there are differences from your code.
 
antman8969's Avatar
Posts: 64 | Thanked: 58 times | Joined on Jul 2010 @ United States
#8
Originally Posted by Joorin View Post
If you access a container directly (but I'm only assuming you do) without first checking its length, you will end up with, in the best case, odd results or, as in this case, failure. Typically, using an iterator is the safer bet since you then get well defined situations if it's, for example, an empty container.

So, your call to the QNetworkAcessManager instance didn't behave as you expected it to. Check what resources this class relies on. How do you instantiate it? What call did you do?

In regards to documentation, I'm not more in the know than you. Qt is a framework with lots of interesting things in it and quite a few hidden dependencies that you need to understand. Have a thorough look at the Qt documentation for network connections and look at the examples (one more time) and try to find if there are differences from your code.
I had thought I was instantiating them correctly, and making requests correctly (.get), which was supported by the application compiling and working fine on desktop...

I'll look further into the Qt classes... It would just really help if I knew the environmental differences between calling from command line vs calling from .desktop file


EDIT: http://bugreports.qt.nokia.com/browse/QTBUG-15004
I Think this bug may be related.

http://wiki.forum.nokia.com/index.ph...vice_to_reboot
This one too, as I have multiple instances of QNetworkAcessManger... although I don't know why sudo would fix it

Last edited by antman8969; 2011-02-21 at 19:01.
 
rooster13's Avatar
Posts: 319 | Thanked: 221 times | Joined on Jan 2010 @ Finland
#9
Would be better if you post the part of code where the problem is.
Otherwise we r just guessin' here.

Also a short introduction about your program would be nice. What is it supposed to do etc.
__________________
Sail Raid, an old skool shoot'em up for Jolla
KillDroid, Android service killer for Jolla
goViihde, an Elisa Viihde client for Jolla
goViihde, an Elisa Viihde client for N9
Shortcut Stash Home Screen Widget
 
antman8969's Avatar
Posts: 64 | Thanked: 58 times | Joined on Jul 2010 @ United States
#10
Originally Posted by rooster13 View Post
Would be better if you post the part of code where the problem is.
Otherwise we r just guessin' here.

Also a short introduction about your program would be nice. What is it supposed to do etc.
source attached in this post

qtweather:
Weather application that pulls data from the National Weather Service. There is one QNetworkAccessManager in the mainwindow.h, and one per every dayperiod object.... of which there are 12. So 13 in total... and I have a feeling the problem lies there.

The application starts off by showing a dialog, which sends a request based on a zipcode. If the request is valid, then an xml file is returned and parsed, and then 12 more managers are created that send one request each to download the icons for the weather for that day.


If you comment out line 278 in mainwindow.cpp
Code:
QString temp(hiloList.at(i));
then it no longer crashes. I suppose it's due to an index out of bounds error, which is caused by the merging of two empty lists (line 187, the hiloList), then iterating up to 12, and reading, despite the list size probably being 0.

This just tells me that the information isn't being returned in the QNetworkReply... when I'm not sudo
Attached Files
File Type: zip qtweather-0.5.orig.zip (310.7 KB, 52 views)

Last edited by antman8969; 2011-02-21 at 19:56.
 
Reply


 
Forum Jump


All times are GMT. The time now is 16:35.