diff --git a/Telegram/SourceFiles/boxes/photosendbox.cpp b/Telegram/SourceFiles/boxes/photosendbox.cpp
index 9ef73bebd..487e2d537 100644
--- a/Telegram/SourceFiles/boxes/photosendbox.cpp
+++ b/Telegram/SourceFiles/boxes/photosendbox.cpp
@@ -69,8 +69,8 @@ PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxW
if (_animated) {
int32 limitW = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
int32 limitH = st::confirmMaxHeight;
- maxW = dimensions.width();
- maxH = dimensions.height();
+ maxW = qMax(dimensions.width(), 1);
+ maxH = qMax(dimensions.height(), 1);
if (maxW * limitH > maxH * limitW) {
if (maxW < limitW) {
maxH = maxH * limitW / maxW;
@@ -446,8 +446,8 @@ EditCaptionBox::EditCaptionBox(HistoryItem *msg) : AbstractBox(st::boxWideWidth)
if (_animated) {
int32 limitW = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
int32 limitH = st::confirmMaxHeight;
- maxW = dimensions.width();
- maxH = dimensions.height();
+ maxW = qMax(dimensions.width(), 1);
+ maxH = qMax(dimensions.height(), 1);
if (maxW * limitH > maxH * limitW) {
if (maxW < limitW) {
maxH = maxH * limitW / maxW;
diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h
index fd7b7f1f0..e52f18572 100644
--- a/Telegram/SourceFiles/config.h
+++ b/Telegram/SourceFiles/config.h
@@ -20,9 +20,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#pragma once
-static const int32 AppVersion = 9033;
-static const wchar_t *AppVersionStr = L"0.9.33";
-static const bool DevVersion = false;
+static const int32 AppVersion = 9034;
+static const wchar_t *AppVersionStr = L"0.9.34";
+static const bool DevVersion = true;
//#define BETA_VERSION (9030002ULL) // just comment this line to build public version
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
diff --git a/Telegram/SourceFiles/gui/popupmenu.cpp b/Telegram/SourceFiles/gui/popupmenu.cpp
index 38c2d9056..d78746c87 100644
--- a/Telegram/SourceFiles/gui/popupmenu.cpp
+++ b/Telegram/SourceFiles/gui/popupmenu.cpp
@@ -561,7 +561,7 @@ void PopupTooltip::onShow() {
}
void PopupTooltip::onWndActiveChanged() {
- if (!App::wnd()->windowHandle()->isActive()) {
+ if (!App::wnd() || !App::wnd()->windowHandle() || !App::wnd()->windowHandle()->isActive()) {
PopupTooltip::Hide();
}
}
diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp
index 067d97cdb..846ae6e76 100644
--- a/Telegram/SourceFiles/history.cpp
+++ b/Telegram/SourceFiles/history.cpp
@@ -1118,7 +1118,9 @@ bool DialogsList::del(const PeerId &peerId, DialogRow *replacedBy) {
if (i == rowByPeer.cend()) return false;
DialogRow *row = i.value();
- emit App::main()->dialogRowReplaced(row, replacedBy);
+ if (App::main()) {
+ emit App::main()->dialogRowReplaced(row, replacedBy);
+ }
if (row == current) {
current = row->next;
@@ -6179,7 +6181,7 @@ HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId id,
, _text(st::msgMinWidth)
, _textWidth(0)
, _textHeight(0)
-, _media(0) {
+, _media(nullptr) {
UserData *fwdViaBot = fwd->viaBot();
int32 viaBotId = fwdViaBot ? peerToUser(fwdViaBot->id) : 0;
int32 fwdViewsCount = fwd->viewsCount(), views = (fwdViewsCount > 0) ? fwdViewsCount : (isPost() ? 1 : -1);
@@ -6197,7 +6199,7 @@ HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId id,
, _text(st::msgMinWidth)
, _textWidth(0)
, _textHeight(0)
- , _media(0) {
+ , _media(nullptr) {
create((flags & MTPDmessage::flag_via_bot_id) ? viaBotId : 0, isPost() ? 1 : -1);
setText(msg, entities);
@@ -6208,7 +6210,7 @@ HistoryItem(history, block, msgId, flags, date, (flags & MTPDmessage::flag_from_
, _text(st::msgMinWidth)
, _textWidth(0)
, _textHeight(0)
-, _media(0) {
+, _media(nullptr) {
create((flags & MTPDmessage::flag_via_bot_id) ? viaBotId : 0, isPost() ? 1 : -1);
initMediaFromDocument(doc, caption);
@@ -6220,7 +6222,7 @@ HistoryItem(history, block, msgId, flags, date, (flags & MTPDmessage::flag_from_
, _text(st::msgMinWidth)
, _textWidth(0)
, _textHeight(0)
-, _media(0) {
+, _media(nullptr) {
create((flags & MTPDmessage::flag_via_bot_id) ? viaBotId : 0, isPost() ? 1 : -1);
_media = new HistoryPhoto(photo, caption, this);
@@ -6516,8 +6518,10 @@ void HistoryMessage::setMedia(const MTPMessageMedia *media) {
bool mediaWasDisplayed = false;
if (_media) {
mediaWasDisplayed = _media->isDisplayed();
+
+ _media->unregItem(this);
delete _media;
- _media = 0;
+ _media = nullptr;
}
QString t;
initMedia(media, t);
@@ -7504,6 +7508,7 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) {
const MTPDmessageActionChatEditPhoto &d(action.c_messageActionChatEditPhoto());
if (d.vphoto.type() == mtpc_photo) {
_media = new HistoryPhoto(history()->peer, d.vphoto.c_photo(), st::msgServicePhotoWidth);
+ _media->regItem(this);
}
text = isPost() ? lang(lng_action_changed_photo_channel) : lng_action_changed_photo(lt_from, from);
} break;
@@ -7879,7 +7884,10 @@ HistoryServiceMsg::~HistoryServiceMsg() {
App::historyUnregDependency(this, pinned->msg);
}
}
- deleteAndMark(_media);
+ if (_media) {
+ _media->unregItem(this);
+ deleteAndMark(_media);
+ }
}
HistoryDateMsg::HistoryDateMsg(History *history, HistoryBlock *block, const QDate &date) :
diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist
index ccbf8be3b..9b9e5021a 100644
--- a/Telegram/Telegram.plist
+++ b/Telegram/Telegram.plist
@@ -11,7 +11,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.9.32
+ 0.9.34
CFBundleSignature
????
CFBundleURLTypes
diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc
index a798dcff0..561c9685c 100644
--- a/Telegram/Telegram.rc
+++ b/Telegram/Telegram.rc
@@ -34,8 +34,8 @@ IDI_ICON1 ICON "SourceFiles\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,9,32,0
- PRODUCTVERSION 0,9,32,0
+ FILEVERSION 0,9,34,0
+ PRODUCTVERSION 0,9,34,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
- VALUE "FileVersion", "0.9.32.0"
+ VALUE "FileVersion", "0.9.34.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
- VALUE "ProductVersion", "0.9.32.0"
+ VALUE "ProductVersion", "0.9.34.0"
END
END
BLOCK "VarFileInfo"
diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj
index ae8d312aa..0596a0e83 100644
--- a/Telegram/Telegram.xcodeproj/project.pbxproj
+++ b/Telegram/Telegram.xcodeproj/project.pbxproj
@@ -1726,7 +1726,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 0.9.32;
+ CURRENT_PROJECT_VERSION = 0.9.34;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -1745,7 +1745,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 0.9.32;
+ CURRENT_PROJECT_VERSION = 0.9.34;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
@@ -1774,10 +1774,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 0.9.32;
+ CURRENT_PROJECT_VERSION = 0.9.34;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 0.9;
- DYLIB_CURRENT_VERSION = 0.9.32;
+ DYLIB_CURRENT_VERSION = 0.9.34;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@@ -1915,10 +1915,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 0.9.32;
+ CURRENT_PROJECT_VERSION = 0.9.34;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.9;
- DYLIB_CURRENT_VERSION = 0.9.32;
+ DYLIB_CURRENT_VERSION = 0.9.34;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = "";
diff --git a/Telegram/Version b/Telegram/Version
index f6b6466c7..e08da93b4 100644
--- a/Telegram/Version
+++ b/Telegram/Version
@@ -1,6 +1,6 @@
-AppVersion 9033
+AppVersion 9034
AppVersionStrMajor 0.9
-AppVersionStrSmall 0.9.33
-AppVersionStr 0.9.33
-DevChannel 0
+AppVersionStrSmall 0.9.34
+AppVersionStr 0.9.34
+DevChannel 1
BetaVersion 0 9030002