Disable logMessageCallback for C++/CLI.

This commit is contained in:
levlam 2021-05-20 10:29:50 +03:00
parent 3d28aaca62
commit 3f9b3046a6

View File

@ -21,6 +21,7 @@ namespace Td {
using namespace CxCli;
#if !TD_CLI
/// <summary>
/// A type of callback function that will be called when a message is added to the internal TDLib log.
/// </summary>
@ -28,6 +29,7 @@ using namespace CxCli;
/// then TDLib will crash as soon as the callback returns.</param>
/// <param name="message">Null-terminated string with the message added to the log.</param>
public delegate void LogMessageCallback(int verbosityLevel, String^ message);
#endif
/// <summary>
/// Interface for handler for results of queries to TDLib and incoming updates from TDLib.
@ -113,6 +115,7 @@ public:
return REF_NEW Client(updateHandler);
}
#if !TD_CLI
/// <summary>
/// Sets the callback that will be called when a message is added to the internal TDLib log.
/// None of the TDLib methods can be called from the callback.
@ -130,6 +133,7 @@ public:
::td::ClientManager::set_log_message_callback(max_verbosity_level, LogMessageCallbackWrapper);
}
}
#endif
private:
Client(ClientResultHandler^ updateHandler) {
@ -154,6 +158,7 @@ private:
}
}
#if !TD_CLI
static std::mutex logMutex;
static LogMessageCallback^ logMessageCallback;
@ -163,10 +168,13 @@ private:
callback(verbosity_level, string_from_unmanaged(message));
}
}
#endif
};
#if !TD_CLI
std::mutex Client::logMutex;
LogMessageCallback^ Client::logMessageCallback;
#endif
} // namespace Td
} // namespace Telegram