Skip to content

Commit

Permalink
Fix issues on Windows.
Browse files Browse the repository at this point in the history
Fix bug causing crash on Windows where the SpecMeasManager::m_spectrumManagerWindow pointer was not initialized to nullptr (I guess on macOS it *happened* to be set to nullptr).
Fixed some other compile issues and warnings on Windows.

Enabled remote-riid on automatedf build.
Backed out not checking run status for automated build (still allowing time-out - but I think that can also be removed).
  • Loading branch information
wcjohns committed Jul 7, 2023
1 parent eef9752 commit c9e5c7a
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 20 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
#cmake -DInterSpec_FETCH_DEPENDENCIES=OFF -DCMAKE_INSTALL_PREFIX=InterSpec_app_${{runner.os}}_WebView_latest -DCMAKE_PREFIX_PATH="${{runner.temp}}\install" -DNO_CMAKE_SYSTEM_PATH=ON -DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache "${{github.workspace}}/target/wxWidgets"
$prefix = "${{runner.temp}}/install"
$install_dir = "InterSpec_app_Windows_WebView_latest"
cmake -DInterSpec_FETCH_DEPENDENCIES=OFF -DUSE_LEAFLET_MAP=ON -DLEAFLET_MAPS_KEY=LEAFLET_KEY="$env:LEAFLET_KEY" -DCMAKE_INSTALL_PREFIX="$install_dir" -DCMAKE_PREFIX_PATH="${{runner.temp}}\install" -DNO_CMAKE_SYSTEM_PATH=ON -DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DwxWidgets_ROOT_DIR="$prefix" -DwxWidgets_LIB_DIR="$prefix/lib/vc_x64_lib" -DwxWidgets_CONFIGURATION="msw" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_CONFIGURATION_TYPES="Release" -DCMAKE_CONFIGURATION_TYPES="Release" -G "Ninja" "${{github.workspace}}/target/wxWidgets"
cmake -DInterSpec_FETCH_DEPENDENCIES=OFF -DUSE_LEAFLET_MAP=ON -DLEAFLET_MAPS_KEY=LEAFLET_KEY="$env:LEAFLET_KEY" -DUSE_REMOTE_RID=ON -DCMAKE_INSTALL_PREFIX="$install_dir" -DCMAKE_PREFIX_PATH="${{runner.temp}}\install" -DNO_CMAKE_SYSTEM_PATH=ON -DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DwxWidgets_ROOT_DIR="$prefix" -DwxWidgets_LIB_DIR="$prefix/lib/vc_x64_lib" -DwxWidgets_CONFIGURATION="msw" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_CONFIGURATION_TYPES="Release" -DCMAKE_CONFIGURATION_TYPES="Release" -G "Ninja" "${{github.workspace}}/target/wxWidgets"
# The build -j1 is needed for debug builds to avoid error "fatal error C1041: cannot open program database...", which I think is happening, not because of the "/FS" flag, but because of multiple targets sharing an intermediate directory - maybe
- name: wxWidgets app build
Expand Down Expand Up @@ -116,9 +116,9 @@ jobs:
if ($errTimedOut) { Stop-Process -InputObject $p -Force }
echo "Exit code of InterSpec test load was was" $p.ExitCode
$rval = $p.ExitCode
if($rval -eq -11){ echo "Loading InterSpec timed-out, but accepting this for the moment, since it seems to work"; }
#exit $rval
exit 0
if($rval -eq -11){ $rval = 0; echo "Loading InterSpec timed-out, but accepting this for the moment, since it seems to work"; }
exit $rval
# If Stop-Process had to be used, the exit code will be -1. If resources didnt load -12. If timed out inside InterSpec -11. If all was okay, 0
# However, some time in Jun 2023, things started timing out (to give return code -11) regularly, even though everything was fine - so we'll allow this, for the moment, but need to look into more.

Expand Down
3 changes: 1 addition & 2 deletions InterSpec/SpecMeasManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,13 @@ class SpecMeasManager : public Wt::WObject


private:
AuxWindow* m_spectrumManagerWindow;
Wt::WContainerWidget *createButtonBar();
void deleteSpectrumManager();
Wt::WContainerWidget *createTreeViewDiv();


protected:
AuxWindow *m_spectrumManagerWindow;
RowStretchTreeView *m_treeView;
SpectraFileModel *m_fileModel;
Wt::WFileUpload *m_fileUpload;
Expand Down
20 changes: 18 additions & 2 deletions src/GammaCountDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,24 @@ void GammaCountDialog::handleAppUrl( std::string query_str )
const auto upper_iter = values.find( "HIGH" );
string lower_str = (lower_iter != end(values)) ? lower_iter->second : string();
string upper_str = (upper_iter != end(values)) ? upper_iter->second : string();
try{ std::stod(lower_str); }catch(...){ lower_str = ""; }
try{ std::stod(upper_str); }catch(...){ upper_str = ""; }
try
{
const double val = std::stod(lower_str);
if( IsInf( val ) || IsNan( val ) )
throw runtime_error( "" );
}catch(...)
{
lower_str = "";
}
try
{
const double val = std::stod(upper_str);
if( IsInf( val ) || IsNan( val ) )
throw runtime_error( "" );
}catch(...)
{
upper_str = "";
}

auto primary = m_specViewer->displayedHistogram( SpecUtils::SpectrumType::Foreground );
if( lower_str.empty() && primary && (primary->num_gamma_channels() > 0) )
Expand Down
8 changes: 1 addition & 7 deletions src/MoreNuclideInfoDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,7 @@ void MoreNuclideInfoDisplay::setNuclide( const SandiaDecay::Nuclide *const nuc,

const auto more_info_db = MoreNucInfoDb::instance();
if( more_info_db )
{
#ifndef NDEBUG
#warning "Reseting MoreNucInfoDb for iterating purposes - remove this!"
cerr << "Reseting MoreNucInfoDb for iterating purposes - remove this!" << endl;
MoreNucInfoDb::remove_global_instance();
#endif

{
const NucInfo *const more_info = more_info_db->info( nuc );

if( !more_info )
Expand Down
2 changes: 1 addition & 1 deletion src/QRSpectrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2188,7 +2188,7 @@ std::shared_ptr<SpecMeas> to_spec_file( const std::vector<UrlSpectrum> &spec_inf
int dev_code()
{
make_example_qr_codes();
return;
return 0;

// Now that URL encoding has solidified - this function should be cleaned up to use that code
// to compute statistics of how many QR codes it typically takes and such.
Expand Down
3 changes: 3 additions & 0 deletions src/RemoteRid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@

#include <boost/process.hpp>
#include <boost/filesystem.hpp>
#if( defined(_WIN32) )
#include <boost/process/windows.hpp>
#endif

#include <Wt/Utils>
#include <Wt/WMenu>
Expand Down
1 change: 1 addition & 0 deletions src/SpecMeasManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ class UploadBrowser : public AuxWindow

SpecMeasManager::SpecMeasManager( InterSpec *viewer )
: WObject(),
m_spectrumManagerWindow( nullptr ),
m_treeView( NULL ),
m_fileModel( NULL ),
m_fileUpload( NULL ),
Expand Down
13 changes: 9 additions & 4 deletions target/wxWidgets/InterSpecWxApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,16 @@ InterSpecWxApp::InterSpecWxApp() :
parser.AddSwitch( "l", "test-load",
"Test that the applicaiton successfully loads and then exits.",
wxCMD_LINE_PARAM_OPTIONAL );
parser.AddSwitch( "d", "dev",
"Opens html/js developer console.",
wxCMD_LINE_PARAM_OPTIONAL );

parser.AddLongOption( "proxy",
"Proxy configuration to use (only applicable to maps tool); valid values are:"
" empty (defualt), 'direct', 'auto_detect', 'system', "
"or any other string any other string will be interpreted as the 'proxyRules'.",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL );

parser.AddParam("File or URI to open", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE);
}

Expand Down Expand Up @@ -318,6 +321,9 @@ InterSpecWxApp::InterSpecWxApp() :
if( parser.Found( "max-run-time", &sm_max_runtime_seconds ) && (sm_max_runtime_seconds > 0) )
sm_max_runtime_timer.reset( new MaxRuntimeTimer( this, sm_max_runtime_seconds ) );

if( parser.FoundSwitch( "dev" ) == wxCMD_SWITCH_ON )
sm_open_dev_console = true;

sm_command_line_parsed = true;

return true;
Expand Down Expand Up @@ -464,6 +470,8 @@ InterSpecWxApp::InterSpecWxApp() :

void InterSpecWxApp::handle_javascript_error_internal( const std::string &error_msg, const std::string &app_token )
{
wxLogMessage( "Have JS Error; msg='%s', session='%s'", error_msg, app_token );

std::cout << "JS Error: " << error_msg << std::endl;
if( sm_test_load_only )
{
Expand Down Expand Up @@ -514,9 +522,6 @@ InterSpecWxApp::InterSpecWxApp() :
frame->Close();
else
close_all_windows_and_exit();


wxLogMessage( "Have JS Error; msg='%s', session='%s'", error_msg, app_token );
}//void handle_javascript_error_internal( const std::string &error_msg, const std::string &app_token );


Expand Down

0 comments on commit c9e5c7a

Please sign in to comment.