crash in pinnedbar fix, assertion info added to crash report, onViewsIncrement() and updateCounter() checks added, returned style fake qt args for Xubuntu 15.10, 0.9.33 stable (Linux only)

This commit is contained in:
John Preston 2016-03-16 00:13:32 +03:00
parent 3226c93f88
commit b3f11e7dff
10 changed files with 42 additions and 22 deletions

View File

@ -20,8 +20,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
static const int32 AppVersion = 9032;
static const wchar_t *AppVersionStr = L"0.9.32";
static const int32 AppVersion = 9033;
static const wchar_t *AppVersionStr = L"0.9.33";
static const bool DevVersion = false;
//#define BETA_VERSION (9030002ULL) // just comment this line to build public version

View File

@ -3606,9 +3606,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
_migrated->unreadBar->destroy();
}
if (_pinnedBar) {
delete _pinnedBar;
_pinnedBar = nullptr;
_inPinnedMsg = false;
destroyPinnedBar();
}
_history = _migrated = 0;
updateBotKeyboard();
@ -6842,9 +6840,7 @@ void HistoryWidget::updatePinnedBar(bool force) {
if (_peer && _peer->isMegagroup()) {
_peer->asChannel()->mgInfo->pinnedMsgId = 0;
}
delete _pinnedBar;
_pinnedBar = nullptr;
_inPinnedMsg = false;
destroyPinnedBar();
resizeEvent(0);
update();
}
@ -6892,8 +6888,7 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
App::api()->requestMessageData(_peer->asChannel(), _pinnedBar->msgId, new ReplyEditMessageDataCallback());
}
} else if (_pinnedBar) {
delete _pinnedBar;
_pinnedBar = nullptr;
destroyPinnedBar();
result = true;
_scroll.scrollToY(_scroll.scrollTop() - st::replyHeight);
resizeEvent(0);
@ -6901,6 +6896,12 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
return result;
}
void HistoryWidget::destroyPinnedBar() {
delete _pinnedBar;
_pinnedBar = nullptr;
_inPinnedMsg = false;
}
void HistoryWidget::ReplyEditMessageDataCallback::call(ChannelData *channel, MsgId msgId) const {
if (App::main()) {
App::main()->messageDataReceived(channel, msgId);

View File

@ -736,6 +736,7 @@ private:
PinnedBar *_pinnedBar;
void updatePinnedBar(bool force = false);
bool pinnedMsgVisibilityUpdated();
void destroyPinnedBar();
void unpinDone(const MTPUpdates &updates);
class ReplyEditMessageDataCallback : public SharedCallback2<void, ChannelData*, MsgId> {

View File

@ -1021,4 +1021,8 @@ namespace SignalHandlers {
}
}
void setAssertionInfo(const QString &info) {
ProcessAnnotations["Assertion"] = info.toUtf8().constData();
}
}

View File

@ -108,5 +108,6 @@ namespace SignalHandlers {
void finish();
void setSelfUsername(const QString &username);
void setAssertionInfo(const QString &info);
}

View File

@ -38,14 +38,21 @@ int main(int argc, char *argv[]) {
Logs::start(); // must be started before PlatformSpecific is started
PlatformSpecific::start(); // must be started before QApplication is created
//QByteArray args[] = { "-style=0" }; // prepare fake args to disable QT_STYLE_OVERRIDE env variable
//static const int a_cnt = sizeof(args) / sizeof(args[0]);
//int a_argc = a_cnt + 1;
//char *a_argv[a_cnt + 1] = { argv[0], args[0].data() };
// prepare fake args to disable QT_STYLE_OVERRIDE env variable
// currently this is required in some desktop environments, including Xubuntu 15.10
// when we don't default style to "none" Qt dynamically loads GTK somehow internally and
// our own GTK dynamic load and usage leads GTK errors and freeze of the current main thread
// we can't disable our own GTK loading because it is required by libappindicator, which
// provides the tray icon for this system, because Qt tray icon is broken there
// see https://github.com/telegramdesktop/tdesktop/issues/1774
QByteArray args[] = { "-style=0" };
static const int a_cnt = sizeof(args) / sizeof(args[0]);
int a_argc = a_cnt + 1;
char *a_argv[a_cnt + 1] = { argv[0], args[0].data() };
int result = 0;
{
Application app(argc, argv);
Application app(a_argc, a_argv);
result = app.exec();
}

View File

@ -2166,6 +2166,8 @@ void MainWidget::scheduleViewIncrement(HistoryItem *item) {
}
void MainWidget::onViewsIncrement() {
if (!App::main() || !MTP::authedId()) return;
for (ViewsIncrement::iterator i = _viewsToIncrement.begin(); i != _viewsToIncrement.cend();) {
if (_viewsIncrementRequests.contains(i.key())) {
++i;

View File

@ -46,6 +46,9 @@ public:
};
#define qsl(s) QStringLiteral(s)
#define qstr(s) QLatin1String(s, sizeof(s) - 1)
// using for_const instead of plain range-based for loop to ensure usage of const_iterator
// it is important for the copy-on-write Qt containers
// if you have "QVector<T*> v" then "for (T * const p : v)" will still call QVector::detach(),
@ -97,7 +100,9 @@ using std::swap;
static volatile int *t_assert_nullptr = 0;
inline void t_noop() {}
inline void t_assert_fail(const char *message, const char *file, int32 line) {
LOG(("Assertion Failed! %1 %2:%3").arg(message).arg(file).arg(line));
QString info(qsl("%1 %2:%3").arg(message).arg(file).arg(line));
LOG(("Assertion Failed! %1 %2:%3").arg(info));
SignalHandlers::setAssertionInfo(info);
*t_assert_nullptr = 0;
}
#define t_assert_full(condition, message, file, line) ((!(condition)) ? t_assert_fail(message, file, line) : t_noop())
@ -265,9 +270,6 @@ private:
};
#define qsl(s) QStringLiteral(s)
#define qstr(s) QLatin1String(s, sizeof(s) - 1)
inline QString fromUtf8Safe(const char *str, int32 size = -1) {
if (!str || !size) return QString();
if (size < 0) size = int32(strlen(str));

View File

@ -697,6 +697,8 @@ void Window::setupMain(bool anim, const MTPUser *self) {
}
void Window::updateCounter() {
if (App::quitting()) return;
psUpdateCounter();
title->updateCounter();
}

View File

@ -1,6 +1,6 @@
AppVersion 9032
AppVersion 9033
AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.32
AppVersionStr 0.9.32
AppVersionStrSmall 0.9.33
AppVersionStr 0.9.33
DevChannel 0
BetaVersion 0 9030002