Re: [SailfishDevel] Closing an application without killing the main loop

2013-12-12 Thread Lucien XU
Hello,

I don't know what's the best way to do it, but here are some ideas.

1. Use aboutToQuit and block it with a QEventLoop ? It might not be enough and 
   might leave the application cover open on the multitask grid, making it 
   look not responding.
2. Launch a script / program when quitting, that performs the async task.

Cheers,
Lucien

Le mercredi 11 décembre 2013 22:51:48 Ville Ranki a écrit :
 Hello,
 
 I'm the author of Siilihai web forum reader http://siilihai.com and
 i'm currently porting it to Sailfish.
 
 Siilihai needs to synchronize it's status (read messages etc) to a
 remote server when user quits it.
 
 I have not found a way to do it in Sailfish. When user closes the
 application, Sailfish terminates the Qt main loop which effectively
 makes it impossible to do any asynchronous tasks.
 
 On desktop QApplication::setQuitOnLastWindowClosed(false) can be
 used to instruct Qt to continue running main loop when last
 window is closed, but it does not work on Sailfish.
 
 Restarting the main loop worked on Harmattan, but on Sailfish
 it causes a crash inside Qt-Wayland code (qwaylandeventthread.cpp line
 37). I also tried to create a Qt event filter with no success.
 
 
 Here is a example application to demonstrate the issue:
 
http://talk.maemo.org/attachment.php?attachmentid=33970d=1386249527
 
 This application creates a repeating timer which stops working
 when the window is closed.
 
 I have already asked about the issue on TMO and #sailfishos, but didn't
 get any satisfactory answers.
 
 http://talk.maemo.org/showthread.php?t=91947
 
 The question is: is this a bug or intended behavior? Can anyone hack
 the example application so that the timer keeps running after the window
 is closed?
 
 --
 Ville Ranki ville.ra...@iki.fi
 http://www.iki.fi/~cos
 PGP public key: http://www.iki.fi/~cos/vranki_pub.asc
 ___
 SailfishOS.org Devel mailing list
___
SailfishOS.org Devel mailing list

Re: [SailfishDevel] Closing an application without killing the main loop

2013-12-12 Thread Mikko Harju
On 11.12.2013 22:51, Ville Ranki wrote:

 I have not found a way to do it in Sailfish. When user closes the
 application, Sailfish terminates the Qt main loop which effectively
 makes it impossible to do any asynchronous tasks.

Have you ran it on the actual device? It might be that the fix did not
make it to the SDK. It should work on the device, however.

 Here is a example application to demonstrate the issue:
 http://talk.maemo.org/attachment.php?attachmentid=33970d=1386249527

WORKSFORME :)

-- 
mikko

___
SailfishOS.org Devel mailing list


[SailfishDevel] Closing an application without killing the main loop

2013-12-11 Thread Ville Ranki
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


Hello,

I'm the author of Siilihai web forum reader http://siilihai.com and
i'm currently porting it to Sailfish.

Siilihai needs to synchronize it's status (read messages etc) to a
remote server when user quits it.

I have not found a way to do it in Sailfish. When user closes the
application, Sailfish terminates the Qt main loop which effectively
makes it impossible to do any asynchronous tasks.

On desktop QApplication::setQuitOnLastWindowClosed(false) can be
used to instruct Qt to continue running main loop when last
window is closed, but it does not work on Sailfish.

Restarting the main loop worked on Harmattan, but on Sailfish
it causes a crash inside Qt-Wayland code (qwaylandeventthread.cpp line
37). I also tried to create a Qt event filter with no success.


Here is a example application to demonstrate the issue:
http://talk.maemo.org/attachment.php?attachmentid=33970d=1386249527

This application creates a repeating timer which stops working
when the window is closed.

I have already asked about the issue on TMO and #sailfishos, but didn't
get any satisfactory answers.

http://talk.maemo.org/showthread.php?t=91947

The question is: is this a bug or intended behavior? Can anyone hack
the example application so that the timer keeps running after the window
is closed?

- -- 
Ville Ranki ville.ra...@iki.fi
http://www.iki.fi/~cos
PGP public key: http://www.iki.fi/~cos/vranki_pub.asc
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlKo0GQACgkQVm11nqR7UVwRQgCggY2EljkXfRGPA447691ztsqs
fHMAnRTEAy146K9L+I/u1GkCpaoEn1xj
=iwsA
-END PGP SIGNATURE-
___
SailfishOS.org Devel mailing list