Changeset 19768 in vbox for trunk/src/VBox/Main/cbinding
- Timestamp:
- May 18, 2009 9:46:21 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/cbinding/tstXPCOMCCall.c
r19751 r19768 129 129 printf("OnStateChange: %s\n", GetStateName(state)); 130 130 fflush(stdout); 131 if (state == MachineState_PoweredOff) 132 g_fStop = 1; 131 133 return 0; 132 134 } … … 276 278 } 277 279 278 printf("vboxCallback QueryInterface didn't find a matching interface\n");280 /* printf("vboxCallback QueryInterface didn't find a matching interface\n"); */ 279 281 printUUID(iid); 280 282 printUUID(&ivirtualboxCallbackUUID); … … 307 309 nsresult rc; 308 310 309 rc = virtualBox->vtbl->OpenExistingSession(virtualBox, session, machineId);310 session->vtbl->GetConsole(session, &console);311 if (console){311 rc = session->vtbl->GetConsole(session, &console); 312 if ((NS_SUCCEEDED(rc)) && console) 313 { 312 314 IConsoleCallback *consoleCallback = NULL; 313 315 … … 315 317 consoleCallback->vtbl = calloc(1, sizeof(struct IConsoleCallback_vtbl)); 316 318 317 if (consoleCallback && consoleCallback->vtbl) {318 319 if (consoleCallback && consoleCallback->vtbl) 320 { 319 321 consoleCallback->vtbl->nsisupports.AddRef = &AddRef; 320 322 consoleCallback->vtbl->nsisupports.Release = &Release; … … 340 342 g_refcount = 1; 341 343 342 console->vtbl->RegisterCallback(console, consoleCallback);343 344 rc = console->vtbl->RegisterCallback(console, consoleCallback); 345 if (NS_SUCCEEDED(rc)) 344 346 { 345 347 /* crude way to show how it works, but any … … 348 350 PRInt32 fd; 349 351 350 printf("Entering event loop, press Ctrl-C to terminate\n");352 printf("Entering event loop, PowerOff the machine to exit or press Ctrl-C to terminate\n"); 351 353 fflush(stdout); 352 354 signal(SIGINT, sigIntHandler); 353 355 354 356 fd = queue->vtbl->GetEventQueueSelectFD(queue); 355 if (fd >= 0) { 356 while (!g_fStop) { 357 if (fd >= 0) 358 { 359 while (!g_fStop) 360 { 357 361 struct pollfd pfd; 358 362 pfd.fd = fd; … … 362 366 rc = queue->vtbl->ProcessPendingEvents(queue); 363 367 } 364 } else { 365 while (!g_fStop) { 368 } 369 else 370 { 371 while (!g_fStop) 372 { 366 373 PLEvent *pEvent = NULL; 367 374 rc = queue->vtbl->WaitForEvent(queue, &pEvent); … … 376 383 consoleCallback->vtbl->nsisupports.Release((nsISupports *)consoleCallback); 377 384 } 378 } 379 session->vtbl->Close((void *)session); 385 else 386 { 387 printf("Failed while allocating memory for console Callback.\n"); 388 } 389 } 380 390 } 381 391
Note:
See TracChangeset
for help on using the changeset viewer.