Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Insanely long OS shutdown time



  • systempaths.h
    @
    #ifndef SYSTEMPATHS_H
    #define SYSTEMPATHS_H

    #include <QObject>
    #include <QApplication>
    #include <QStandardPaths>

    class SystemPaths : public QObject
    {
    Q_OBJECT
    public:

    static QString defaultIniPath();
    static QString defaultCapturePath();
    
    //Fixed
    static QString licenecePath();
    static QString manualPath();
    static QString logPath();
    
    
    QString iniPath();
    QString capturePath();
    

    signals:

    void iniPathChanged(QString path);
    void capturePathChanged(QString path);
    

    public slots:

    void setIniPath(QString path);
    void setCapturePath(QString path);
    

    private:

    QString m_iniPath;
    QString m_capturePath;
    

    };
    @

    systempaths.cpp
    @
    #include "systempaths.h"

    //Defaults
    //
    QString SystemPaths::defaultIniPath()
    {
    return QApplication::applicationDirPath()+"/camera.ini";
    }

    QString SystemPaths::defaultCapturePath()
    {
    return QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
    }

    //Fixed
    //
    QString SystemPaths::licenecePath()
    {
    return QApplication::applicationDirPath() + "/licence.dat";
    }

    QString SystemPaths::manualPath()
    {
    return QApplication::applicationDirPath() + "/manual.pdf";
    }

    QString SystemPaths::logPath()
    {
    return QApplication::applicationDirPath() + "/log.txt";
    }

    //Getter
    //

    QString SystemPaths::iniPath()
    {
    return m_iniPath;
    }

    QString SystemPaths::capturePath()
    {
    return m_capturePath;
    }

    //Setter
    //

    void SystemPaths::setIniPath(QString path)
    {
    m_iniPath = path;
    emit iniPathChanged(m_iniPath);
    }

    void SystemPaths::setCapturePath(QString path)
    {
    m_capturePath = path;
    emit capturePathChanged(m_capturePath);
    }
    @

    With only using the static functions in several other classes, the following happened: (os: linux mint 17.1 Cinnamon x64)
    -I pushed the shutdown button (set to shut down, without question)
    -The application closed
    -But something pevented the os from shutting down for 15-20 sec

    After removing the class, and change all its usages, to the same code the class used, the problem disappeares.

    What was wrong with that class?



  • Hi, how do you call your class method, do you have an example of use that caused this? (Another class calling SystemPaths)

    Thanks


Log in to reply