Details
-
Bug
-
Resolution: Incomplete
-
P1: Critical
-
None
-
5.15.10
-
None
-
windows10 vs2015
Description
QTextEdit* mytext = new QTextEdit(parent);
setAcceptRichText(false);
setReadOnly(true);
setUndoRedoEnabled(false);
setTextColor(lineColor);
append("14:41:51: 开始读取数据计算数据(v:2.8.3),请等待...");
When the above code append, layoutData is a null pointer at the following location, causing the program to crash
inline bool ensureSpace(int nGlyphs) const
{ if (layoutData->glyphLayout.numGlyphs - layoutData->used < nGlyphs) return layoutData->reallocate((((layoutData->used + nGlyphs)*3/2 + 15) >> 4) << 4); return true; }Also in QTextLineItemIterator: : next () collapse, layoutData is also a null pointer.
- The crash caused by layoutData being a null pointer is accidental.
eg:
class MsgListener
{
public:
MsgListener(){};
virtual ~MsgListener() {}
virtual void showMsg(const QString & qsMsg, int nType) = 0;
};
---------------------------------------------------------------------
static QList<MsgListener *> MsgListeners;
class MsgManage
{
public:
~MsgManage();
static void Register_Listener(MsgListener * pListener);
static void Unregister_Listener(MsgListener * pListener);
static bool ShowMsg( const QString & qsMsg,int nType = -1 )
{
for (int i = 0; i < MsgListeners.size(); ++i)
}
private:
MsgManage();
};
---------------------------------------------------------------------
DockMsgOutput : public QDockWidget,MsgListener
void DockMsgOutput::showMsg(const QString & qsMsg, int nType)
---------------------------------------------------------------------
callback(qsMsg,type)
{ MsgManage::showMsg(qsMsg,type) }