mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
fix(assert): remove runtime assert that could crash production builds
use debug only assert to remove the possibility that we self inflict crashes on users Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
8c4576fe98
commit
72bc312bca
@ -142,7 +142,7 @@ Folder::Folder(const FolderDefinition &definition,
|
||||
});
|
||||
|
||||
// Potentially upgrade suffix vfs to windows vfs
|
||||
ENFORCE(_vfs);
|
||||
Q_ASSERT(_vfs);
|
||||
if (_definition.virtualFilesMode == Vfs::WithSuffix
|
||||
&& _definition.upgradeVfsMode) {
|
||||
if (isVfsPluginAvailable(Vfs::WindowsCfApi)) {
|
||||
@ -513,8 +513,8 @@ void Folder::createGuiLog(const QString &filename, LogStatus status, int count,
|
||||
|
||||
void Folder::startVfs()
|
||||
{
|
||||
ENFORCE(_vfs);
|
||||
ENFORCE(_vfs->mode() == _definition.virtualFilesMode);
|
||||
Q_ASSERT(_vfs);
|
||||
Q_ASSERT(_vfs->mode() == _definition.virtualFilesMode);
|
||||
|
||||
const auto result = Vfs::checkAvailability(path(), _vfs->mode());
|
||||
if (!result) {
|
||||
|
||||
@ -483,7 +483,7 @@ QString networkReplyErrorString(const QNetworkReply &reply)
|
||||
|
||||
void AbstractNetworkJob::retry()
|
||||
{
|
||||
ENFORCE(_reply);
|
||||
Q_ASSERT(_reply);
|
||||
auto req = _reply->request();
|
||||
QUrl requestedUrl = req.url();
|
||||
QByteArray verb = HttpLogger::requestVerb(*_reply);
|
||||
|
||||
@ -839,7 +839,7 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(const SyncFileItemPtr &it
|
||||
item->_size = sizeOnServer;
|
||||
|
||||
if (serverEntry.isDirectory) {
|
||||
ENFORCE(dbEntry.isDirectory());
|
||||
Q_ASSERT(dbEntry.isDirectory());
|
||||
item->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA;
|
||||
} else if (!localEntry.isValid() && _queryLocal != ParentNotChanged) {
|
||||
// Deleted locally, changed on server
|
||||
|
||||
@ -249,10 +249,10 @@ void DiscoveryPhase::markPermanentDeletionRequests()
|
||||
|
||||
void DiscoveryPhase::startJob(ProcessDirectoryJob *job)
|
||||
{
|
||||
ENFORCE(!_currentRootJob);
|
||||
Q_ASSERT(!_currentRootJob);
|
||||
connect(this, &DiscoveryPhase::itemDiscovered, this, &DiscoveryPhase::slotItemDiscovered, Qt::UniqueConnection);
|
||||
connect(job, &ProcessDirectoryJob::finished, this, [this, job] {
|
||||
ENFORCE(_currentRootJob == sender());
|
||||
Q_ASSERT(_currentRootJob == sender());
|
||||
_currentRootJob = nullptr;
|
||||
if (job->_dirItem)
|
||||
emit itemDiscovered(job->_dirItem);
|
||||
|
||||
@ -226,7 +226,7 @@ void blacklistUpdate(SyncJournalDb *journal, SyncFileItem &item)
|
||||
void PropagateItemJob::done(const SyncFileItem::Status statusArg, const QString &errorString, const ErrorCategory category)
|
||||
{
|
||||
// Duplicate calls to done() are a logic error
|
||||
ENFORCE(_state != Finished);
|
||||
Q_ASSERT(_state != Finished);
|
||||
_state = Finished;
|
||||
|
||||
_item->_status = statusArg;
|
||||
@ -1294,7 +1294,7 @@ void PropagatorCompositeJob::slotSubJobFinished(SyncFileItem::Status status)
|
||||
// Delete the job and remove it from our list of jobs.
|
||||
subJob->deleteLater();
|
||||
int i = _runningJobs.indexOf(subJob);
|
||||
ENFORCE(i >= 0); // should only happen if this function is called more than once
|
||||
Q_ASSERT(i >= 0); // should only happen if this function is called more than once
|
||||
_runningJobs.remove(i);
|
||||
|
||||
// Any sub job error will cause the whole composite to fail. This is important
|
||||
|
||||
Loading…
Reference in New Issue
Block a user