diff --git a/engine/Client.cpp b/engine/Client.cpp index 64907b43..04f88215 100644 --- a/engine/Client.cpp +++ b/engine/Client.cpp @@ -105,9 +105,11 @@ private: class PostponedMessage : public Message { public: - inline PostponedMessage(const Message& msg, int id) - : Message(msg), m_id(id) - { } + inline PostponedMessage(const Message& msg, int id, bool copyUserData) + : Message(msg), m_id(id) { + if (copyUserData) + userData(msg.userData()); + } inline int id() const { return m_id; } private: @@ -1761,11 +1763,11 @@ bool Client::received(Message& msg, int id) } // Postpone messages to be redispatched from UI thread -bool Client::postpone(const Message& msg, int id) +bool Client::postpone(const Message& msg, int id, bool copyUserData) { if (isCurrent()) return false; - PostponedMessage* postponed = new PostponedMessage(msg,id); + PostponedMessage* postponed = new PostponedMessage(msg,id,copyUserData); s_postponeMutex.lock(); s_postponed.append(postponed); s_postponeMutex.unlock(); diff --git a/yatecbase.h b/yatecbase.h index bc191286..e8ce9eb7 100644 --- a/yatecbase.h +++ b/yatecbase.h @@ -1072,9 +1072,10 @@ public: * Postpone a copy of a message to be dispatched from the UI thread * @param msg Message to be postponed * @param id Identifier of the message to be used on dispatch + * @param copyUserData Copy source user data in postponed message * @return True if the UI thread was not current so the message was postponed */ - bool postpone(const Message& msg, int id); + bool postpone(const Message& msg, int id, bool copyUserData = false); /** * Show a file open dialog window