mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-27 11:10:19 -06:00
72548a99e1
Desktop runtime has a couple bugs using already freed memory supplied to embedded python leading to occasional crashes and failures to start maintenance processes (VACUUM, ANALYZE, REINDEX, CLUSTER). This is caused by incorrect usage of QString::toUtf8() which returns newly created QByteArray which is automatically destroyed once closing context; e.g. Py_SetPythonHome(pythonHome.toUtf8().data());
53 lines
1.0 KiB
C++
53 lines
1.0 KiB
C++
//////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2017, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
// Server.h - Thread in which the web server will run.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef SERVER_H
|
|
#define SERVER_H
|
|
|
|
#include "pgAdmin4.h"
|
|
|
|
// QT headers
|
|
#include <QThread>
|
|
#include <QMessageBox>
|
|
|
|
class Server : public QThread
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
Server(quint16 port, QString key);
|
|
~Server();
|
|
|
|
bool Init();
|
|
QString getError() { return m_error; };
|
|
|
|
protected:
|
|
void run();
|
|
|
|
private:
|
|
void setError(QString error) { m_error = error; };
|
|
|
|
QString m_appfile;
|
|
QString m_error;
|
|
|
|
quint16 m_port;
|
|
QString m_key;
|
|
// Application name in UTF-8 for Python
|
|
wchar_t *m_wcAppName;
|
|
QByteArray PGA_APP_NAME_UTF8;
|
|
// PythonHome for Python
|
|
wchar_t *m_wcPythonHome;
|
|
QByteArray pythonHome_utf8;
|
|
};
|
|
|
|
#endif // SERVER_H
|
|
|