Hey,

2010/12/9 luca paone <[email protected]>:
> I Have almost the same problem. we have a Qt-Wt application
> with this main.cpp:
> -----------------------
>
>        QList< Wt::WApplication * >* appList = new QList< Wt::WApplication * >;
>        Server server(argc, argv, appList,&data);
>        server.start();//ATTENTION il websession server is in a  different
> thread from gateway
>
>        Gateway gateway(argc, argv, appList);//our Qt main class that connects
> to other TCP/IPdevices
>
>        QCoreApplication::exec();
>
>
> }
> ---------------------
> The server definition is :...
> class Server : public QThread
> {
>        Q_OBJECT
>
>        public:
>                static Server* instance();//return unique instance
>
>                Server(int argc, char** argv , QList< Wt::WApplication * >
> *p_applist,CommonData *data);
>                ~Server();
>                void run();
> };
> void Server::run()
> {
>        try
>        {
>                WServer server(m_argv[0]);
>
>                // WTHTTP_CONFIGURATION is e.g. "/etc/wt/wthttpd"
>                server.setServerConfiguration(m_argc, m_argv,
> "/etc/wt/wthttpd");
>
>                // ENTRY POINT
>                server.addEntryPoint(Wt::Application, createApplication);
>
>                if (server.start())
>                {
>                        int sig = WServer::waitForShutdown(m_argv[0]);
>
>                        std::cerr << "Shutdown (signal = " << sig << ")" <<
> std::endl;
>                        server.stop();
>
>                        if (sig == SIGHUP)
>                                WServer::restart(m_argc, m_argv, environ);
>                }
>        }
>        catch (WServer::Exception& e)
>        {
> ....
>        }
> }
> ---------------------------------------
> Now every 1 second Gateway class fires a timeout that sould update a label in
> every Wapplication to refresh time and date, but even if we call UpdateLock() 
> it
> results a core dump due to a null instance-session!
> This is the calling code:
>
>
> void Gateway::TimerRefresh()
> {
>
>
>        QMutexLocker lock(&mutex_deletesession);//to avoid server delete
> sessions unexpextedly
>
>        for (int varsession = 0; varsession < (*p_applist_intern).size();
> ++varsession)
>        {
>                WebSessionSDM* session = (WebSessionSDM*) (*p_applist_intern)
> [varsession];//WebSession is our simple Wapplication derived class, in
> p_applist_intern we store all created Wapplicaiton object
>
>                if (!session)
>                        return;
>
>                Wt::WApplication::UpdateLock lock =session->getUpdateLock();
>
>                session->Timer1secTick();//call label upadte
>
>                session->triggerUpdate();//HERE CORE DUMPS!!

This should be okay though. With what version of Wt is this? This
should work using the same fix as mentioned earlier in the thread,
thus you need a git version of Wt.

Regards,
koen

------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to