Catch exceptions by reference
We use polymorphic exception objects, so catching by value invokes
the copy constructor and stuff that we don't really want.
diff --git a/win/vncconfig/Connections.h b/win/vncconfig/Connections.h
index 3d3c06c..b3402ab 100644
--- a/win/vncconfig/Connections.h
+++ b/win/vncconfig/Connections.h
@@ -76,7 +76,7 @@
try {
network::TcpFilter::Pattern pat(network::TcpFilter::parsePattern(CStr(newPat.buf)));
pattern.replaceBuf(TCharArray(network::TcpFilter::patternToStr(pat)).takeBuf());
- } catch(rdr::Exception e) {
+ } catch(rdr::Exception& e) {
MsgBox(NULL, TStr(e.str()), MB_ICONEXCLAMATION | MB_OK);
return false;
}
@@ -261,7 +261,7 @@
(http_port != getItemInt(IDC_HTTP_PORT)) ||
((http_port!=0) != (isItemChecked(IDC_HTTP_ENABLE)!=0)) ||
(rfb::Server::idleTimeout != getItemInt(IDC_IDLE_TIMEOUT));
- } catch (rdr::Exception) {
+ } catch (rdr::Exception&) {
return false;
}
}
diff --git a/win/vncconfig/Legacy.cxx b/win/vncconfig/Legacy.cxx
index 7d51de8..b56eb37 100644
--- a/win/vncconfig/Legacy.cxx
+++ b/win/vncconfig/Legacy.cxx
@@ -127,7 +127,7 @@
// Finally, save the Hosts value
regKey.setString(_T("Hosts"), TStr(newHosts.buf));
- } catch (rdr::Exception) {
+ } catch (rdr::Exception&) {
MsgBox(0, _T("Unable to convert AuthHosts setting to Hosts format."),
MB_ICONWARNING | MB_OK);
}
@@ -148,7 +148,7 @@
regKey.setBool(_T("AlwaysShared"), connectPriority == 1);
regKey.setBool(_T("NeverShared"), connectPriority == 2);
- } catch(rdr::Exception) {
+ } catch(rdr::Exception&) {
}
// Open the local, default-user settings