diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
|---|---|---|
| committer | <> | 2014-05-08 15:03:54 +0000 |
| commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
| tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp | |
| parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
| download | VirtualBox-master.tar.gz | |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp')
| -rw-r--r-- | src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp b/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp index 64bcd25f..53e49b7f 100644 --- a/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp +++ b/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2011 Oracle Corporation + * Copyright (C) 2006-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -27,7 +27,7 @@ #include <VBox/com/ErrorInfo.h> #include <VBox/com/errorprint.h> -#include <VBox/com/EventQueue.h> +#include <VBox/com/NativeEventQueue.h> #include <VBox/com/VirtualBox.h> using namespace com; @@ -732,6 +732,10 @@ static CComModule _Module; extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp) { +#ifdef Q_WS_X11 + if (!XInitThreads()) + return 1; +#endif #ifdef VBOXSDL_WITH_X11 /* * Lock keys on SDL behave different from normal keys: A KeyPress event is generated @@ -949,11 +953,17 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp) } // first check if a UUID was supplied uuidVM = argv[curArg]; - if (uuidVM.isEmpty()) + + if (!uuidVM.isValid()) { LogFlow(("invalid UUID format, assuming it's a VM name\n")); vmName = argv[curArg]; } + else if (uuidVM.isZero()) + { + RTPrintf("Error: UUID argument is zero!\n"); + return 1; + } } else if ( !strcmp(argv[curArg], "--comment") || !strcmp(argv[curArg], "-comment")) @@ -1371,7 +1381,7 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp) ComPtr<IVirtualBox> pVirtualBox; ComPtr<ISession> pSession; bool sessionOpened = false; - EventQueue* eventQ = com::EventQueue::getMainEventQueue(); + NativeEventQueue* eventQ = com::NativeEventQueue::getMainEventQueue(); ComPtr<IMachine> pMachine; @@ -1416,7 +1426,7 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp) /* * Do we have a UUID? */ - if (!uuidVM.isEmpty()) + if (uuidVM.isValid()) { rc = pVirtualBox->FindMachine(uuidVM.toUtf16().raw(), pMachine.asOutParam()); if (FAILED(rc) || !pMachine) @@ -1439,20 +1449,28 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp) } else { - RTPrintf("Error: machine with the given ID not found!\n"); + RTPrintf("Error: machine with the given name not found!\n"); + RTPrintf("Check if this VM has been corrupted and is now inaccessible."); goto leave; } } - else if (uuidVM.isEmpty()) - { - RTPrintf("Error: no machine specified!\n"); - goto leave; - } /* create SDL event semaphore */ vrc = RTSemEventCreate(&g_EventSemSDLEvents); AssertReleaseRC(vrc); + rc = pVirtualBoxClient->CheckMachineError(pMachine); + if (FAILED(rc)) + { + com::ErrorInfo info; + if (info.isFullAvailable()) + PrintError("The VM has errors", + info.getText().raw(), info.getComponent().raw()); + else + RTPrintf("Failed to check for VM errors! No error information available (rc=%Rhrc).\n", rc); + goto leave; + } + rc = pMachine->LockMachine(pSession, LockType_VM); if (FAILED(rc)) { @@ -3028,6 +3046,10 @@ static RTEXITCODE settingsPasswordFile(ComPtr<IVirtualBox> virtualBox, const cha */ int main(int argc, char **argv) { +#ifdef Q_WS_X11 + if (!XInitThreads()) + return 1; +#endif /* * Before we do *anything*, we initialize the runtime. */ |
