| Prev |   1     2   3 |
maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Closing an application without killing main loop (https://talk.maemo.org/showthread.php?t=91947)

vranki 2013-12-05 13:23

Re: Closing an application without killing main loop
 
1 Attachment(s)
I attached a simple test application to this message. It creates a sailfish app and a timer printing a message every second. Before starting the app, it calls app->setQuitOnLastWindowClosed(false).

When you close the window, the mainloop exits and messages stop appearing.

Can anyone modify it so that after closing the window it still keeps running? Is current behavior a bug?

w00t 2013-12-05 13:48

Re: Closing an application without killing main loop
 
This was a bug in the early SDK releases. Make sure you have the latest SDK.

See also: http://talk.maemo.org/showthread.php?t=91595

Note that I have no problems running this on device.

vranki 2013-12-05 14:00

Re: Closing an application without killing main loop
 
Quote:

Originally Posted by w00t (Post 1392870)
This was a bug in the early SDK releases. Make sure you have the latest SDK.

Maintenance tool reports no updates available.

Quote:

Originally Posted by w00t (Post 1392870)
See also: http://talk.maemo.org/showthread.php?t=91595

Note that I have no problems running this on device.

Could you elaborate a little.. What exactly is printed to console when you close the app by swiping down? Does the process really stay running?

w00t 2013-12-05 14:18

Re: Closing an application without killing main loop
 
Quote:

Originally Posted by vranki (Post 1392874)
Maintenance tool reports no updates available.

I don't know what to tell you, then. All I can say is that it's working fine, and I'm fairly sure we already fixed this :)

Quote:

Originally Posted by vranki (Post 1392874)
Could you elaborate a little.. What exactly is printed to console when you close the app by swiping down? Does the process really stay running?

The timer keeps running and printing. Yes.

ggabriel 2013-12-05 15:20

Re: Closing an application without killing main loop
 
Quote:

Originally Posted by w00t (Post 1392881)
I don't know what to tell you, then. All I can say is that it's working fine, and I'm fairly sure we already fixed this :)

Is there any way to tell for certain the version of the SDK, aside from Alpha? (perhaps a git revision or similar?)

Alternatively, I suggest resintalling the SDK :-D

vranki 2013-12-06 11:01

Re: Closing an application without killing main loop
 
Quote:

Originally Posted by ggabriel (Post 1392893)
Is there any way to tell for certain the version of the SDK, aside from Alpha? (perhaps a git revision or similar?)

Alternatively, I suggest resintalling the SDK :-D

I checked my SDK version (0.0.8-2) and Mer VM (2013.10.18-0) and they are the latest.


Can anyone give a third opinion how the app behaves on close?

vranki 2013-12-06 13:18

Re: Closing an application without killing main loop
 
I just tested in SDK with another PC and the application still behaves incorrectly:

Code:

Timer (and main loop) is still alive
Timer (and main loop) is still alive
Timer (and main loop) is still alive
Timer (and main loop) is still alive
Timer (and main loop) is still alive
app->exec() exited - main loop stopped. This should NOT happen if user closed the window. But it does.
Remote application finished with exit code 0.


vranki 2013-12-18 15:54

Re: Closing an application without killing main loop
 
The issue is now resolved. The bug was in still in latest SDK and was recently fixed by a SDK update. It also works correctly on device. Thanks for help!

mikecomputing 2013-12-22 16:58

Re: Closing an application without killing main loop
 
No I am really confused.

Because in my case my app dont leave mainloop and in my case I want it to leave :confused:


Code:


    QGuiApplication *app = SailfishApp::application(argc, argv);
    app->setQuitOnLastWindowClosed(true);
    UDPManager *udp = new UDPManager();
    QQuickView *view = SailfishApp::createView();
    QObject::connect(app, SIGNAL(lastWindowClosed()), app, SLOT(quit()));
    view->rootContext()->setContextProperty("version", QString(VERSION));
    view->rootContext()->setContextProperty("udp", udp);
    view->setSource(QString("/usr/share/harbour-push2sail/qml/push2sail.qml"));
    view->showFullScreen();
    res = app->exec(); // stays here even when user swipe down and window closes
    delete app;
    delete udp;
    return res;


coderus 2013-12-22 18:23

Re: Closing an application without killing main loop
 
maybe just emulator bug. test on device and ignore emulator bug if arm build works okay :)


| Prev |   1     2   3 |
All times are GMT. The time now is 13:25.

vBulletin® Version 3.8.8