From: Marcus Eggenberger Date: Sun, 10 Aug 2008 11:58:40 +0000 (+0200) Subject: Revert "fixing BR #264 (core crash after join)" X-Git-Tag: 0.3.0~77 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=b772dadd3eac1cd3dba935bd185474db63f6cffb Revert "fixing BR #264 (core crash after join)" This reverts commit ce4dc5d6d32af97589c15529f67f15218c381488. --- diff --git a/src/core/ircserverhandler.cpp b/src/core/ircserverhandler.cpp index b6879bb4..58a23020 100644 --- a/src/core/ircserverhandler.cpp +++ b/src/core/ircserverhandler.cpp @@ -216,12 +216,6 @@ void IrcServerHandler::handleMode(const QString &prefix, const QList emit displayMsg(Message::Mode, BufferInfo::ChannelBuffer, serverDecode(params[0]), serverDecode(params).join(" "), prefix); IrcChannel *channel = network()->ircChannel(params[0]); - if(!channel) { - // we received mode information for a channel we're not in. that means probably we've just been kicked out or something like that - // anyways: we don't have a place to store the data --> discard the info. - return; - } - QString modes = params[1]; bool add = true; int paramOffset = 2; diff --git a/src/qtui/chatlinemodelitem.cpp b/src/qtui/chatlinemodelitem.cpp index 9b9e71c2..84832cdf 100644 --- a/src/qtui/chatlinemodelitem.cpp +++ b/src/qtui/chatlinemodelitem.cpp @@ -26,23 +26,7 @@ #include "qtui.h" #include "uistyle.h" -// This Struct is taken from Harfbuzz. We use it only to calc it's size. -// we use a shared memory region so we do not have to malloc a buffer area for every line -typedef struct { - /*HB_LineBreakType*/ unsigned lineBreakType :2; - /*HB_Bool*/ unsigned whiteSpace :1; /* A unicode whitespace character, except NBSP, ZWNBSP */ - /*HB_Bool*/ unsigned charStop :1; /* Valid cursor position (for left/right arrow) */ - /*HB_Bool*/ unsigned wordBoundary :1; - /*HB_Bool*/ unsigned sentenceBoundary :1; - unsigned unused :2; -} HB_CharAttributes_Dummy; - -unsigned char *ChatLineModelItem::TextBoundaryFinderBuffer = (unsigned char *)malloc(512 * sizeof(HB_CharAttributes_Dummy)); -int ChatLineModelItem::TextBoundaryFinderBufferSize = 512 * (sizeof(HB_CharAttributes_Dummy) / sizeof(unsigned char)); - -ChatLineModelItem::ChatLineModelItem(const Message &msg) - : MessageModelItem(msg) -{ +ChatLineModelItem::ChatLineModelItem(const Message &msg) : MessageModelItem(msg) { QtUiStyle::StyledMessage m = QtUi::style()->styleMessage(msg); _timestamp.plainText = m.timestamp.plainText; @@ -58,49 +42,40 @@ ChatLineModelItem::ChatLineModelItem(const Message &msg) QVariant ChatLineModelItem::data(int column, int role) const { - const ChatLinePart *part = 0; + const ChatLinePart *part; switch(column) { - case ChatLineModel::TimestampColumn: - part = &_timestamp; - break; - case ChatLineModel::SenderColumn: - part = &_sender; - break; - case ChatLineModel::ContentsColumn: - part = &_contents; - break; - default: - return MessageModelItem::data(column, role); + case ChatLineModel::TimestampColumn: part = &_timestamp; break; + case ChatLineModel::SenderColumn: part = &_sender; break; + case ChatLineModel::ContentsColumn: part = &_contents; break; + default: return MessageModelItem::data(column, role); } switch(role) { - case ChatLineModel::DisplayRole: - return part->plainText; - case ChatLineModel::FormatRole: - return QVariant::fromValue(part->formatList); - case ChatLineModel::WrapListRole: - if(column != ChatLineModel::ContentsColumn) - return QVariant(); - return QVariant::fromValue(_wrapList); + case ChatLineModel::DisplayRole: + return part->plainText; + case ChatLineModel::FormatRole: + return QVariant::fromValue(part->formatList); + case ChatLineModel::WrapListRole: + if(column != ChatLineModel::ContentsColumn) return QVariant(); + return QVariant::fromValue(_wrapList); } + return MessageModelItem::data(column, role); } -void ChatLineModelItem::computeWrapList() { - if(_contents.plainText.isEmpty()) - return; +bool ChatLineModelItem::setData(int column, const QVariant &value, int role) { + return false; +} +void ChatLineModelItem::computeWrapList() { enum Mode { SearchStart, SearchEnd }; QList wplist; // use a temp list which we'll later copy into a QVector for efficiency - // QTextBoundaryFinder finder(QTextBoundaryFinder::Word, _contents.plainText); - QTextBoundaryFinder finder(QTextBoundaryFinder::Word, _contents.plainText.unicode(), _contents.plainText.length(), TextBoundaryFinderBuffer, TextBoundaryFinderBufferSize); - + QTextBoundaryFinder finder(QTextBoundaryFinder::Word, _contents.plainText); int idx; int oldidx = 0; - bool wordStart = false; - bool wordEnd = false; + bool wordStart = false; bool wordEnd = false; Mode mode = SearchEnd; ChatLineModel::Word word; word.start = 0; diff --git a/src/qtui/chatlinemodelitem.h b/src/qtui/chatlinemodelitem.h index a2ef9b9a..a4df5203 100644 --- a/src/qtui/chatlinemodelitem.h +++ b/src/qtui/chatlinemodelitem.h @@ -22,30 +22,31 @@ #define CHATLINEMODELITEM_H_ #include +#include #include "chatlinemodel.h" #include "uistyle.h" class ChatLineModelItem : public MessageModelItem { -public: - ChatLineModelItem(const Message &); - virtual QVariant data(int column, int role) const; - virtual inline bool setData(int column, const QVariant &value, int role) { return false; } + public: -private: - void computeWrapList(); + ChatLineModelItem(const Message &); + //virtual ~ChatLineModelItem() {}; - struct ChatLinePart { - QString plainText; - UiStyle::FormatList formatList; - }; - ChatLinePart _timestamp, _sender, _contents; + virtual QVariant data(int column, int role) const; + virtual bool setData(int column, const QVariant &value, int role); - ChatLineModel::WrapList _wrapList; + private: + void computeWrapList(); - static unsigned char *TextBoundaryFinderBuffer; - static int TextBoundaryFinderBufferSize; + struct ChatLinePart { + QString plainText; + UiStyle::FormatList formatList; + }; + ChatLinePart _timestamp, _sender, _contents; + + ChatLineModel::WrapList _wrapList; }; #endif