telegram-desktop-3.6.1-r1 + fix-double-destruction (multiply accs) added.

master
Kolan Sh 2022-04-13 23:42:00 +03:00
parent d5b2d334fb
commit 6ef6776496
8 changed files with 381 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST tdesktop-3.6.1-full.tar.gz 41226549 SHA256 1e87df0970b135d566f5af4bc6c2695fc98ba387dc1137100a478f02d48c12e8 SHA512 dd216c720ea3b1c72669805bb31319746a7ddfe746d188bf2ae0c5cdf0a10b379fc2e888a26fe755d77381fc5d9aa638cedc76b2dce1f1126a9c1ef9c02da2ba WHIRLPOOL 9cbf5c46bc937793ab37d7ccf93ab391aee2b3fb06ce7b07c1767af126875db5489a6f8aa6897281f71d44d71f08c7e6cd2ec1a24d4be673ca7e188bb6ef8030

View File

@ -0,0 +1,20 @@
--- tdesktop-3.3.0-full.orig/Telegram/lib_spellcheck/spellcheck/platform/linux/spellcheck_linux.cpp
+++ tdesktop-3.3.0-full/Telegram/lib_spellcheck/spellcheck/platform/linux/spellcheck_linux.cpp
@@ -34,7 +34,7 @@
auto IsHebrew(const QString &word) {
// Words with mixed scripts will be automatically ignored,
// so this check should be fine.
- return ::Spellchecker::WordScript(&word) == QChar::Script_Hebrew;
+ return ::Spellchecker::WordScript(word) == QChar::Script_Hebrew;
}
class EnchantSpellChecker {
@@ -154,7 +154,7 @@
}
auto EnchantSpellChecker::findSuggestions(const QString &word) {
- const auto wordScript = ::Spellchecker::WordScript(&word);
+ const auto wordScript = ::Spellchecker::WordScript(word);
auto w = word.toStdString();
std::vector<QString> result;
if (!_validators.size()) {

View File

@ -0,0 +1,33 @@
Stub out some glibc-specific functions
This allows support for alternative libcs like musl
--- tdesktop-3.5.2-full.orig/Telegram/lib_base/base/platform/linux/base_info_linux.cpp
+++ tdesktop-3.5.2-full/Telegram/lib_base/base/platform/linux/base_info_linux.cpp
@@ -22,7 +22,7 @@
#include <sys/utsname.h>
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) && defined(__GLIBC__)
#include <gnu/libc-version.h>
#endif // Q_OS_LINUX
@@ -200,7 +200,7 @@
}
QString GetLibcName() {
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) && defined(__GLIBC__)
return "glibc";
#endif // Q_OS_LINUX
@@ -208,7 +208,7 @@
}
QString GetLibcVersion() {
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) && defined(__GLIBC__)
static const auto result = [&] {
const auto version = QString::fromLatin1(gnu_get_libc_version());
return QVersionNumber::fromString(version).isNull() ? QString() : version;

View File

@ -0,0 +1,41 @@
Only link jemalloc for the Telegram binary
Some combination of factors is making the different codegen tools hang when
jemalloc is linked for those, and they're ran under portage's sandbox. Since
this is only used during build-time, and jemalloc is merely necessary to
improve runtime memory use, it's unnecessary to use it for anything else.
--- tdesktop-3.6.0-full.orig/Telegram/CMakeLists.txt
+++ tdesktop-3.6.0-full/Telegram/CMakeLists.txt
@@ -1376,6 +1376,14 @@
desktop-app::external_kwayland
)
endif()
+
+ if (NOT DESKTOP_APP_DISABLE_JEMALLOC)
+ target_link_libraries(Telegram
+ INTERFACE
+ $<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper>
+ $<LINK_ONLY:desktop-app::external_jemalloc>
+ )
+ endif()
endif()
if (build_macstore)
--- tdesktop-3.6.0-full.orig/cmake/options_linux.cmake
+++ tdesktop-3.6.0-full/cmake/options_linux.cmake
@@ -62,14 +62,6 @@
target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto -fuse-linker-plugin>)
endif()
-if (NOT DESKTOP_APP_DISABLE_JEMALLOC)
- target_link_libraries(common_options
- INTERFACE
- $<TARGET_OBJECTS:desktop-app::linux_jemalloc_helper>
- $<LINK_ONLY:desktop-app::external_jemalloc>
- )
-endif()
-
target_link_libraries(common_options
INTERFACE
${CMAKE_DL_LIBS}

View File

@ -0,0 +1,75 @@
Support FFmpeg 5
I'm not comfortable changing the _durationInMilliseconds formula on older
versions of ffmpeg. Doing that only for newer versions also reduces the amount
of testing this patch needs (of which it'll get very minimal amounts, this is a
job better left for upstream when they get to it).
Also it doesn't compile under ffmpeg 4 if the variables are constants :/
--- tdesktop-3.6.0-full.orig/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartInternal.cpp
+++ tdesktop-3.6.0-full/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartInternal.cpp
@@ -104,7 +104,11 @@
_frame = av_frame_alloc();
+#if LIBAVFORMAT_VERSION_MAJOR >= 59
+ const AVInputFormat *inputFormat = av_find_input_format(container.c_str());
+#else
AVInputFormat *inputFormat = av_find_input_format(container.c_str());
+#endif
if (!inputFormat) {
_didReadToEnd = true;
return;
@@ -144,7 +148,11 @@
_streamId = i;
+#if LIBAVFORMAT_VERSION_MAJOR >= 59
+ _durationInMilliseconds = inStream->duration * 1000 / 48000;
+#else
_durationInMilliseconds = (int)((inStream->duration + inStream->first_dts) * 1000 / 48000);
+#endif
if (inStream->metadata) {
AVDictionaryEntry *entry = av_dict_get(inStream->metadata, "TG_META", nullptr, 0);
--- tdesktop-3.6.0-full.orig/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp
+++ tdesktop-3.6.0-full/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp
@@ -32,7 +32,11 @@
AudioStreamingPartPersistentDecoderState(AVCodecParameters const *codecParameters, AVRational timeBase) :
_codecParameters(codecParameters),
_timeBase(timeBase) {
+#ifdef LIBAVCODEC_VERSION_MAJOR >= 59
+ const AVCodec *codec = avcodec_find_decoder(codecParameters->codec_id);
+#else
AVCodec *codec = avcodec_find_decoder(codecParameters->codec_id);
+#endif
if (codec) {
_codecContext = avcodec_alloc_context3(codec);
int ret = avcodec_parameters_to_context(_codecContext, codecParameters);
--- tdesktop-3.6.0-full.orig/Telegram/ThirdParty/tgcalls/tgcalls/group/VideoStreamingPart.cpp
+++ tdesktop-3.6.0-full/Telegram/ThirdParty/tgcalls/tgcalls/group/VideoStreamingPart.cpp
@@ -280,7 +280,11 @@
int ret = 0;
+#if LIBAVFORMAT_VERSION_MAJOR >= 59
+ const AVInputFormat *inputFormat = av_find_input_format(container.c_str());
+#else
AVInputFormat *inputFormat = av_find_input_format(container.c_str());
+#endif
if (!inputFormat) {
_didReadToEnd = true;
return;
@@ -323,7 +327,11 @@
}
if (videoCodecParameters && videoStream) {
+#if LIBAVCODEC_VERSION_MAJOR >= 59
+ const AVCodec *codec = avcodec_find_decoder(videoCodecParameters->codec_id);
+#else
AVCodec *codec = avcodec_find_decoder(videoCodecParameters->codec_id);
+#endif
if (codec) {
_codecContext = avcodec_alloc_context3(codec);
ret = avcodec_parameters_to_context(_codecContext, videoCodecParameters);

View File

@ -0,0 +1,46 @@
Description: Do not capture buttons in AccountsList that belong to inner VerticalLayout widget
This fixes a use-after-free error (double destruction) in the main menu right after account switching.
Bug-Debian: https://bugs.debian.org/1008156
Bug-Ubuntu: https://launchpad.net/bugs/1967673
Forwarded: https://github.com/telegramdesktop/tdesktop/pull/24301
Author: Nicholas Guriev <guriev-ns@ya.ru>
Last-Update: Sat, 09 Apr 2022 13:47:55 +0300
diff --git a/Telegram/SourceFiles/settings/settings_information.cpp b/Telegram/SourceFiles/settings/settings_information.cpp
index 092194dcf5ce..08365a9a0c27 100644
--- a/Telegram/SourceFiles/settings/settings_information.cpp
+++ b/Telegram/SourceFiles/settings/settings_information.cpp
@@ -78,9 +78,7 @@ class AccountsList final {
int _outerIndex = 0;
Ui::SlideWrap<Ui::SettingsButton> *_addAccount = nullptr;
- base::flat_map<
- not_null<Main::Account*>,
- base::unique_qptr<Ui::SettingsButton>> _watched;
+ base::flat_map<not_null<Main::Account*>, Ui::SettingsButton*> _watched;
base::unique_qptr<Ui::PopupMenu> _contextMenu;
std::unique_ptr<Ui::VerticalLayoutReorder> _reorder;
@@ -730,7 +728,7 @@ void AccountsList::rebuild() {
order.reserve(inner->count());
for (auto i = 0; i < inner->count(); i++) {
for (const auto &[account, button] : _watched) {
- if (button.get() == inner->widgetAt(i)) {
+ if (button == inner->widgetAt(i)) {
order.push_back(account->session().uniqueId());
}
}
@@ -769,11 +767,11 @@ void AccountsList::rebuild() {
account,
std::move(activate));
};
- button.reset(inner->add(MakeAccountButton(
+ button = inner->add(MakeAccountButton(
inner,
_controller,
account,
- std::move(callback))));
+ std::move(callback)));
}
}
inner->resizeToWidth(_outer->width());

View File

@ -0,0 +1,164 @@
# Copyright 2020-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{8..10} )
inherit xdg cmake python-any-r1 optfeature
DESCRIPTION="Official desktop client for Telegram"
HOMEPAGE="https://desktop.telegram.org"
MY_P="tdesktop-${PV}-full"
SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"
LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv"
IUSE="+dbus enchant +hunspell +jemalloc screencast +spell wayland +X"
REQUIRED_USE="
spell? (
^^ ( enchant hunspell )
)
"
RDEPEND="
!net-im/telegram-desktop-bin
app-arch/lz4:=
dev-cpp/abseil-cpp:=
dev-libs/libdispatch
dev-libs/openssl:=
dev-libs/xxhash
>=dev-qt/qtcore-5.15:5
>=dev-qt/qtgui-5.15:5[dbus?,jpeg,png,wayland?,X?]
>=dev-qt/qtimageformats-5.15:5
>=dev-qt/qtnetwork-5.15:5[ssl]
>=dev-qt/qtsvg-5.15:5
>=dev-qt/qtwidgets-5.15:5[png,X?]
media-fonts/open-sans
media-libs/fontconfig:=
~media-libs/libtgvoip-2.4.4_p20220117
media-libs/openal
media-libs/opus:=
media-libs/rnnoise
~media-libs/tg_owt-0_pre20220209[screencast=,X=]
media-video/ffmpeg:=[opus]
sys-libs/zlib:=[minizip]
dbus? (
dev-cpp/glibmm:2
dev-qt/qtdbus:5
dev-libs/libdbusmenu-qt[qt5(+)]
)
enchant? ( app-text/enchant:= )
hunspell? ( >=app-text/hunspell-1.7:= )
jemalloc? ( dev-libs/jemalloc:=[-lazy-lock] )
wayland? (
dev-qt/qtwayland:=
kde-frameworks/kwayland:=
)
X? ( x11-libs/libxcb:= )
"
DEPEND="${RDEPEND}
dev-cpp/range-v3
=dev-cpp/ms-gsl-3*
"
BDEPEND="
${PYTHON_DEPS}
>=dev-util/cmake-3.16
virtual/pkgconfig
"
# dev-libs/jemalloc:=[-lazy-lock] -> https://bugs.gentoo.org/803233
PATCHES=(
"${FILESDIR}/tdesktop-3.6.0-jemalloc-only-telegram.patch"
"${FILESDIR}/tdesktop-3.3.0-fix-enchant.patch"
"${FILESDIR}/tdesktop-3.5.2-musl.patch"
"${FILESDIR}/tdesktop-3.6.0-support-ffmpeg5.patch"
"${FILESDIR}/tdesktop-3.6.1-fix-double-destruction.patch"
)
# Current desktop-file-utils-0.26 does not understand Version=1.5
QA_DESKTOP_FILE="usr/share/applications/${PN}.desktop"
pkg_pretend() {
if has ccache ${FEATURES}; then
ewarn
ewarn "ccache does not work with ${PN} out of the box"
ewarn "due to usage of precompiled headers"
ewarn "check bug https://bugs.gentoo.org/715114 for more info"
ewarn
fi
}
src_prepare() {
# no explicit toggle, doesn't build with the system one #752417
sed -i 's/DESKTOP_APP_USE_PACKAGED/NO_ONE_WILL_EVER_SET_THIS/' \
cmake/external/rlottie/CMakeLists.txt || die
cmake_src_prepare
}
src_configure() {
local mycmakeargs=(
-DTDESKTOP_LAUNCHER_BASENAME="${PN}"
-DCMAKE_DISABLE_FIND_PACKAGE_tl-expected=ON # header only lib, some git version. prevents warnings.
-DDESKTOP_APP_QT6=OFF
-DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=$(usex !dbus)
-DDESKTOP_APP_DISABLE_X11_INTEGRATION=$(usex !X)
-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=$(usex !wayland)
-DDESKTOP_APP_DISABLE_SPELLCHECK=$(usex !spell) # enables hunspell (recommended)
-DDESKTOP_APP_USE_ENCHANT=$(usex enchant) # enables enchant and disables hunspell
# This option is heavily discouraged by upstream.
# See files/tdesktop-*-jemalloc-optional.patch
-DDESKTOP_APP_DISABLE_JEMALLOC=$(usex !jemalloc)
)
if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
einfo "Found custom API credentials"
mycmakeargs+=(
-DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
-DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
)
else
# https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml
# Building with snapcraft API credentials by default
# Custom API credentials can be obtained here:
# https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md
# After getting credentials you can export variables:
# export MY_TDESKTOP_API_ID="17349""
# export MY_TDESKTOP_API_HASH="344583e45741c457fe1862106095a5eb"
# and restart the build"
# you can set above variables (without export) in /etc/portage/env/net-im/telegram-desktop
# portage will use custom variable every build automatically
mycmakeargs+=(
-DTDESKTOP_API_ID="611335"
-DTDESKTOP_API_HASH="d524b414d21f4d37f08684c1df41ac9c"
)
fi
cmake_src_configure
}
pkg_postinst() {
xdg_pkg_postinst
if ! use X && ! use screencast; then
elog "both the 'X' and 'screencast' useflags are disabled, screen sharing won't work!"
elog
fi
if has_version '<dev-qt/qtcore-5.15.2-r10'; then
ewarn "Versions of dev-qt/qtcore lower than 5.15.2-r10 might cause telegram"
ewarn "to crash when pasting big images from the clipboard."
ewarn
fi
if ! use jemalloc && use elibc_glibc; then
ewarn "Disabling USE=jemalloc on glibc systems may cause very high RAM usage!"
ewarn "Do NOT report issues about RAM usage without enabling this flag first."
ewarn
fi
optfeature_header
optfeature "shop payment support (requires USE=dbus enabled)" net-libs/webkit-gtk
}

View File

@ -207,6 +207,7 @@ net-ftp/filezilla ~amd64
net-im/jitsi-meet-bin ~amd64
<net-im/skypeforlinux-9 ~amd64
net-im/teams ~amd64
net-im/telegram-desktop ~amd64
=net-im/utox-9999 **
=net-im/viber-9999 ~amd64
net-im/zoom ~amd64