VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/GraphicUserInterface.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-07-13 10:14:52 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-07-13 10:14:52 +0200
commit1ee93df3b4adc891b83b05dd82bc6de851898f62 (patch)
tree00d4a721f6791c0b02cabc62ec9ca13ac4f5c057 /src/Main/GraphicUserInterface.cpp
parentbb67a22ac4214db5f1a353bb16508eb347f32c8d (diff)
downloadVeraCrypt-1ee93df3b4adc891b83b05dd82bc6de851898f62.tar.gz
VeraCrypt-1ee93df3b4adc891b83b05dd82bc6de851898f62.zip
Linux: fix linker type confusion that was causing crash.
The class AdminPasswordRequestHandler was defined in several places in the same namespace and the linker was picking up one definition for constructor and the other one when calling virtual method. Now we use different named for different implementations.
Diffstat (limited to 'src/Main/GraphicUserInterface.cpp')
-rw-r--r--src/Main/GraphicUserInterface.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index ad14748e..9169a548 100644
--- a/src/Main/GraphicUserInterface.cpp
+++ b/src/Main/GraphicUserInterface.cpp
@@ -37,6 +37,32 @@
namespace VeraCrypt
{
+ class AdminPasswordGUIRequestHandler : public GetStringFunctor
+ {
+ public:
+ virtual void operator() (string &passwordStr)
+ {
+
+ wxString sValue;
+ if (Gui->GetWaitDialog())
+ {
+ Gui->GetWaitDialog()->RequestAdminPassword(sValue);
+ if (sValue.IsEmpty())
+ throw UserAbort (SRC_POS);
+ }
+ else
+ {
+ wxPasswordEntryDialog dialog (Gui->GetActiveWindow(), LangString["LINUX_ADMIN_PW_QUERY"], LangString["LINUX_ADMIN_PW_QUERY_TITLE"]);
+ if (dialog.ShowModal() != wxID_OK)
+ throw UserAbort (SRC_POS);
+ sValue = dialog.GetValue();
+ }
+ wstring wPassword (sValue); // A copy of the password is created here by wxWidgets, which cannot be erased
+ finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); });
+
+ StringConverter::ToSingle (wPassword, passwordStr);
+ }
+ };
#ifdef TC_MACOSX
int GraphicUserInterface::g_customIdCmdV = 0;
int GraphicUserInterface::g_customIdCmdA = 0;
@@ -452,33 +478,7 @@ namespace VeraCrypt
shared_ptr <GetStringFunctor> GraphicUserInterface::GetAdminPasswordRequestHandler ()
{
- class AdminPasswordRequestHandler : public GetStringFunctor
- {
- public:
- virtual void operator() (string &passwordStr)
- {
-
- wxString sValue;
- if (Gui->GetWaitDialog())
- {
- Gui->GetWaitDialog()->RequestAdminPassword(sValue);
- if (sValue.IsEmpty())
- throw UserAbort (SRC_POS);
- }
- else
- {
- wxPasswordEntryDialog dialog (Gui->GetActiveWindow(), LangString["LINUX_ADMIN_PW_QUERY"], LangString["LINUX_ADMIN_PW_QUERY_TITLE"]);
- if (dialog.ShowModal() != wxID_OK)
- throw UserAbort (SRC_POS);
- sValue = dialog.GetValue();
- }
- wstring wPassword (sValue); // A copy of the password is created here by wxWidgets, which cannot be erased
- finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); });
-
- StringConverter::ToSingle (wPassword, passwordStr);
- }
- };
- return shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler);
+ return shared_ptr <GetStringFunctor> (new AdminPasswordGUIRequestHandler);
}
int GraphicUserInterface::GetCharHeight (wxWindow *window) const