Skip to content

Commit

Permalink
openmv: Mitigate crashing on connect again.
Browse files Browse the repository at this point in the history
  • Loading branch information
kwagyeman committed Nov 27, 2024
1 parent 7fd3c14 commit eb94a63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmake/QtCreatorIDEBranding.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ set(IDE_ICON_PATH "")
set(IDE_LOGO_PATH "")

# OPENMV-DIFF #
set(IDE_VERSION "4.4.5")
set(IDE_VERSION "4.4.6")
set(IDE_VERSION_COMPAT "${IDE_VERSION}")
set(IDE_VERSION_DISPLAY "${IDE_VERSION}")
set(IDE_AUTHOR "OpenMV LLC")
Expand Down
19 changes: 11 additions & 8 deletions src/plugins/openmv/openmvpluginconnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2483,17 +2483,20 @@ void OpenMVPlugin::connectClicked(bool forceBootloader, QString forceFirmwarePat
{
data = fixScriptForSensor(data);

QFile reload(document->filePath().toString());

if(reload.open(QIODevice::WriteOnly))
if (document->contents().simplified().trimmed() != data.simplified().trimmed())
{
bool ok = reload.write(data) == data.size();
reload.close();
QFile reload(document->filePath().toString());

if (ok)
if(reload.open(QIODevice::WriteOnly))
{
QString error;
document->reload(&error);
bool ok = reload.write(data) == data.size();
reload.close();

if (ok)
{
QString error;
document->reload(&error);
}
}
}
}
Expand Down

0 comments on commit eb94a63

Please sign in to comment.