Merge pull request #515 from ispyisail/fix/valgrind-uninit-machineinfo-firstshow

Thank you @ispyisail
This commit is contained in:
plc-user
2026-06-20 13:19:39 +02:00
committed by GitHub
3 changed files with 15 additions and 6 deletions
+5 -5
View File
@@ -75,11 +75,11 @@ class MachineInfo
{ {
struct Screen struct Screen
{ {
int32_t count; int32_t count = 0;
int32_t width[10]; int32_t width[10] = {};
int32_t height[10]; int32_t height[10]= {};
int32_t Max_width; int32_t Max_width = 0;
int32_t Max_height; int32_t Max_height= 0;
}screen; }screen;
struct Built struct Built
{ {
+5
View File
@@ -241,6 +241,11 @@ QGuiApplication::setHighDpiScaleFactorRoundingPolicy(QetSettings::hdpiScaleFacto
QObject::connect(&app, &SingleApplication::receivedMessage, QObject::connect(&app, &SingleApplication::receivedMessage,
&qetapp, &QETApp::receiveMessage); &qetapp, &QETApp::receiveMessage);
// Pre-initialise on the main (GUI) thread: the constructor calls
// qApp->screens() which is not thread-safe in Qt5 — calling instance()
// here guarantees the singleton is fully built before the worker runs.
MachineInfo::instance();
QtConcurrent::run([=]() QtConcurrent::run([=]()
{ {
// for debugging // for debugging
+5 -1
View File
@@ -80,6 +80,11 @@ class QETDiagramEditor : public QETMainWindow
protected: protected:
bool event(QEvent *) override; bool event(QEvent *) override;
private: private:
// Declared first so it is initialised before any member whose
// constructor may dispatch a Qt event calling event() (e.g. the
// QActionGroup members below trigger QObject::setParent events).
bool m_first_show = true;
QETDiagramEditor(const QETDiagramEditor &); QETDiagramEditor(const QETDiagramEditor &);
void setUpElementsPanel (); void setUpElementsPanel ();
void setUpElementsCollectionWidget(); void setUpElementsCollectionWidget();
@@ -253,7 +258,6 @@ class QETDiagramEditor : public QETMainWindow
QUndoGroup undo_group; QUndoGroup undo_group;
AutoNumberingDockWidget *m_autonumbering_dock; AutoNumberingDockWidget *m_autonumbering_dock;
int activeSubWindowIndex; int activeSubWindowIndex;
bool m_first_show = true;
SearchAndReplaceWidget m_search_and_replace_widget; SearchAndReplaceWidget m_search_and_replace_widget;
}; };
#endif #endif