Examples of errors detected by the V746 diagnostic
V746. Object slicing. An exception should be caught by reference rather than by value.
Oracle VM Virtual Box
V746 Object slicing. An exception should be caught by reference rather than by value. extpackutil.cpp 257
RTCString *VBoxExtPackLoadDesc(....)
{
....
xml::XmlFileParser Parser;
try
{
Parser.read(szFilePath, Doc);
}
catch (xml::XmlError Err) // <=
{
return new RTCString(Err.what());
}
....
}
Similar errors can be found in some other places:
- V746 Object slicing. An exception should be caught by reference rather than by value. extpackutil.cpp 330
OpenToonz
V746 Object slicing. An exception should be caught by reference rather than by value. iocommand.cpp 1620
bool IoCmd::saveLevel(....)
{
....
try {
sl->save(fp, TFilePath(), overwritePalette);
} catch (TSystemException se) { // <=
QApplication::restoreOverrideCursor();
MsgBox(WARNING, QString::fromStdWString(se.getMessage()));
return false;
} catch (...) {
....
}
....
}
Similar errors can be found in some other places:
- V746 Object slicing. An exception should be caught by reference rather than by value. iocommand.cpp 2650
- V746 Object slicing. An exception should be caught by reference rather than by value. projectpopup.cpp 522
- V746 Object slicing. An exception should be caught by reference rather than by value. projectpopup.cpp 537
- And 8 additional diagnostic messages.
Open X-Ray Engine
V746 Object slicing. An exception should be caught by reference rather than by value. object_item_script.cpp 39
ObjectFactory::ServerObjectBaseClass *
CObjectItemScript::server_object (LPCSTR section) const
{
ObjectFactory::ServerObjectBaseClass *object = nullptr;
try {
object = m_server_creator(section);
}
catch(std::exception e) {
Msg("Exception [%s] raised while creating server object "
"from section [%s]", e.what(),section);
return (0);
}
....
}
Notepad++
V746 Object slicing. An exception should be caught by reference rather than by value. filedialog.cpp 183
TCHAR* FileDialog::doOpenSingleFileDlg()
{
....
try {
fn = ::GetOpenFileName(&_ofn)?_fileName:NULL;
if (params->getNppGUI()._openSaveDir == dir_last)
{
::GetCurrentDirectory(MAX_PATH, dir);
params->setWorkingDir(dir);
}
} catch(std::exception e) { // <=
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
} catch(...) {
::MessageBox(NULL, TEXT("....!!!"), TEXT(""), MB_OK);
}
::SetCurrentDirectory(dir);
return (fn);
}
Scilab
V746 Object slicing. An exception should be caught by reference rather than by value. sci_scinotes.cpp 48
int sci_scinotes(char * fname, void* pvApiCtx)
{
....
try
{
callSciNotesW(NULL, 0);
}
catch (GiwsException::JniCallMethodException exception)
{
Scierror(999, "%s: %s\n", fname,
exception.getJavaDescription().c_str());
}
catch (GiwsException::JniException exception)
{
Scierror(999, "%s: %s\n", fname,
exception.whatStr().c_str());
}
....
}
Similar errors can be found in some other places:
- V746 Object slicing. An exception should be caught by reference rather than by value. sci_builddoc.cpp 270
- V746 Object slicing. An exception should be caught by reference rather than by value. sci_closescinotesfromscilab.cpp 45
- V746 Object slicing. An exception should be caught by reference rather than by value. sci_closescinotesfromscilab.cpp 50
- And 9 additional diagnostic messages.
Tizen
V746 Object slicing. An exception should be caught by reference rather than by value. CAudioInput.cpp 225
void CAudioInput::initialize() throw(CAudioError) {
....
} catch (CAudioError err) {
finalize();
throw err;
}
}
Similar errors can be found in some other places:
- V746 Object slicing. An exception should be caught by reference rather than by value. CAudioInput.cpp 298
- V746 Object slicing. An exception should be caught by reference rather than by value. CAudioInput.cpp 334
- V746 Object slicing. An exception should be caught by reference rather than by value. CAudioInput.cpp 368
- And 28 additional diagnostic messages.
Rosegarden
V746 Object slicing. An exception should be caught by reference rather than by value. MupExporter.cpp 197
timeT MupExporter::writeBar(....)
{
....
try {
// tuplet compensation, etc
Note::Type type = e->get<Int>(NOTE_TYPE);
int dots = e->get
<Int>(NOTE_DOTS);
duration = Note(type, dots).getDuration();
} catch (Exception e) { // no properties
RG_WARNING << "WARNING: ...: " << e.getMessage();
}
....
}
class BadSoundFileException : public Exception
Ardour
V746 Object slicing. An exception should be caught by reference rather than by value. ardour_ui.cc 3806
int
ARDOUR_UI::build_session (....)
{
....
try {
new_session = new Session (....);
}
catch (SessionException e) {
....
return -1;
}
catch (...) {
....
return -1;
}
....
}
Similar errors can be found in some other places:
- V746 Object slicing. An exception should be caught by reference rather than by value. ardour_ui.cc 3670
- V746 Object slicing. An exception should be caught by reference rather than by value. luawindow.cc 467
- V746 Object slicing. An exception should be caught by reference rather than by value. luawindow.cc 518
- And 2 additional diagnostic messages.
NCBI Genome Workbench
V746 Object slicing. An exception should be caught by reference rather than by value. cobalt.cpp 247
void
CMultiAligner::SetQueries(const vector< CRef<objects::CBioseq> >& queries)
{
....
try {
seq_loc->SetId(*it->GetSeqId());
}
catch (objects::CObjMgrException e) {
NCBI_THROW(CMultiAlignerException, eInvalidInput,
(string)"Missing seq-id in bioseq. " + e.GetMsg());
}
m_tQueries.push_back(seq_loc);
....
}
Similar errors can be found in some other places:
- V746 Object slicing. An exception should be caught by reference rather than by value. agp_validate_reader.cpp 562
- V746 Object slicing. An exception should be caught by reference rather than by value. aln_build_app.cpp 320
- V746 Object slicing. An exception should be caught by reference rather than by value. aln_test_app.cpp 458
- And 4 additional diagnostic messages.
Xenia
V746 Object slicing. An exception should be caught by reference rather than by value. config.cc 58
std::shared_ptr<cpptoml::table>
ParseConfig(const std::filesystem::path& config_path)
{
try
{
return ParseFile(config_path);
}
catch (cpptoml::parse_exception e) // <=
{
xe::FatalError(
fmt::format("Failed to parse config file '{}':\n\n{}",
xe::path_to_utf8(config_path),
e.what())
);
return nullptr;
}
}