/[svn]/qsampler/trunk/src/qsamplerMainForm.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3128 by capela, Thu Apr 27 11:09:16 2017 UTC revision 3416 by schoenebeck, Tue Feb 6 18:56:33 2018 UTC
# Line 91  static inline long lroundf ( float x ) Line 91  static inline long lroundf ( float x )
91    
92    
93  // All winsock apps needs this.  // All winsock apps needs this.
94  #if defined(WIN32)  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
95  static WSADATA _wsaData;  static WSADATA _wsaData;
96  #endif  #endif
97    
# Line 324  MainForm::MainForm ( QWidget *pParent ) Line 324  MainForm::MainForm ( QWidget *pParent )
324          m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel;          m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel;
325          statusBar()->addWidget(pLabel);          statusBar()->addWidget(pLabel);
326    
327  #if defined(WIN32)  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
328          WSAStartup(MAKEWORD(1, 1), &_wsaData);          WSAStartup(MAKEWORD(1, 1), &_wsaData);
329  #endif  #endif
330    
# Line 425  MainForm::~MainForm() Line 425  MainForm::~MainForm()
425          // Do final processing anyway.          // Do final processing anyway.
426          processServerExit();          processServerExit();
427    
428  #if defined(WIN32)  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
429          WSACleanup();          WSACleanup();
430  #endif  #endif
431    
# Line 2864  void MainForm::stopServer ( bool bIntera Line 2864  void MainForm::stopServer ( bool bIntera
2864                  }                  }
2865          }          }
2866    
2867            bool bGraceWait = true;
2868    
2869          // And try to stop server.          // And try to stop server.
2870          if (m_pServer && m_bForceServerStop) {          if (m_pServer && m_bForceServerStop) {
2871                  appendMessages(tr("Server is stopping..."));                  appendMessages(tr("Server is stopping..."));
2872                  if (m_pServer->state() == QProcess::Running) {                  if (m_pServer->state() == QProcess::Running) {
2873                  #if defined(WIN32)                  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
2874                          // Try harder...                          // Try harder...
2875                          m_pServer->kill();                          m_pServer->kill();
2876                  #else                  #else
2877                          // Try softly...                          // Try softly...
2878                          m_pServer->terminate();                          m_pServer->terminate();
2879                            bool bFinished = m_pServer->waitForFinished(QSAMPLER_TIMER_MSECS * 1000);
2880                            if (bFinished) bGraceWait = false;
2881                  #endif                  #endif
2882                  }                  }
2883          }       // Do final processing anyway.          }       // Do final processing anyway.
2884          else processServerExit();          else processServerExit();
2885    
2886          // Give it some time to terminate gracefully and stabilize...          // Give it some time to terminate gracefully and stabilize...
2887          QTime t;          if (bGraceWait) {
2888          t.start();                  QTime t;
2889          while (t.elapsed() < QSAMPLER_TIMER_MSECS)                  t.start();
2890                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  while (t.elapsed() < QSAMPLER_TIMER_MSECS)
2891                            QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
2892            }
2893  }  }
2894    
2895    

Legend:
Removed from v.3128  
changed lines
  Added in v.3416

  ViewVC Help
Powered by ViewVC