Fix a crash issue due to cfa702a8a8

cfa702a8a8 (Retain read only flag state in session)

Crash can be reproduced by replacing the content by following code (replace YOUR_FULL_FILE_PATH by your existing full file path):

<NotepadPlus>
    <Session activeView="1">
        <mainView activeIndex="0" />
        <subView activeIndex="0">
            <File firstVisibleLine="128" xOffset="0" scrollWidth="8768" startPos="11571" endPos="11571" selMode="0" lang="Normal Text" encoding="-1" filename="YOUR_FULL_FILE_PATH" backupFilePath="" originalFileLastModifTimestamp="-1930112874" originalFileLastModifTimestampHigh="30727970" mapFirstVisibleDisplayLine="-1" mapFirstVisibleDocLine="-1" mapLastVisibleDocLine="-1" mapNbLine="-1" mapHigherPos="-1" mapWidth="-1" mapHeight="-1" mapKByteInDoc="177" mapWrapIndentMode="-1" mapIsWrap="no" />
        </subView>
    </Session>
</NotepadPlus>
This commit is contained in:
Don HO 2019-04-02 23:21:51 +02:00
parent 6e791965bf
commit 9443e2e8f2
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -1833,7 +1833,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode)
} }
buf->setLangType(typeToSet, pLn); buf->setLangType(typeToSet, pLn);
buf->setEncoding(session._subViewFiles[k]._encoding); buf->setEncoding(session._subViewFiles[k]._encoding);
buf->setUserReadOnly(session._mainViewFiles[k]._isUserReadOnly); buf->setUserReadOnly(session._subViewFiles[k]._isUserReadOnly);
if (isSnapshotMode && session._subViewFiles[k]._backupFilePath != TEXT("") && PathFileExists(session._subViewFiles[k]._backupFilePath.c_str())) if (isSnapshotMode && session._subViewFiles[k]._backupFilePath != TEXT("") && PathFileExists(session._subViewFiles[k]._backupFilePath.c_str()))
buf->setDirty(true); buf->setDirty(true);