]> git.sur5r.net Git - bacula/bacula/commitdiff
Corrected a bug in Windows which causes wx-console to crash when typing quit before...
authorNicolas Boichat <nicolas@boichat.ch>
Mon, 26 Apr 2004 20:07:33 +0000 (20:07 +0000)
committerNicolas Boichat <nicolas@boichat.ch>
Mon, 26 Apr 2004 20:07:33 +0000 (20:07 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1309 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/wx-console/CHANGELOG
bacula/src/wx-console/TODO
bacula/src/wx-console/console_thread.cpp
bacula/src/wx-console/csprint.h
bacula/src/wx-console/wxbmainframe.cpp
bacula/src/wx-console/wxbmainframe.h

index dc3c35c7eff8bf34baf95aecfaa80d90d4dc20a6..b972d01d2a8c9faafc0a58b0cf4ab448e5f501d4 100644 (file)
@@ -1,4 +1,8 @@
-25-04-2003 :
+26-04-2004 :
+ - Corrected a bug in Windows which causes wx-console to crash when
+     typing quit before exiting the application.
+
+25-04-2004 :
  - general : status text is more often used
  - wxbRestorePanel : restore aborted if there's no client or no fileset
  - wxbRestorePanel : corrected problem if one double clicks on a
@@ -13,7 +17,7 @@
  - wxbMainFrame : Automatically scrolling to the bottom of 
      console text control.
 
-24-04-2003 :
+24-04-2004 :
  - wxbMainFrame : When starting wx-console, the initial key 
       input focus is set into the command window.
  - wxbMainFrame : the user is now prompted when an 
  - wxbRestorePanel : using dot commands (.clients, .filesets)
  - console_thread : implemented prompt and heartbeat messages
 
-23-04-2003 :
+23-04-2004 :
  - general : Don't concatenate lines in csprint, but in wxbDataParser
          (necessary for dot commands)
 
-22-04-2003 :
+22-04-2004 :
  - wxbRestorePanel : improved restore appearance
  - wxbRestorePanel : configure is allowed to change client
 
index d56fd381594dbffde0774190924bfe2a26b9be20..ffd5c4b8def980752268c09b8a5bb88f50b2bc96 100644 (file)
@@ -18,8 +18,8 @@ wxbRestorePanel : Add a Cancel Restore button
 
 general : Allow the user to quit however the state is (kill thread if necessary)
 
-VC++ : crashing when there's no configuration file, or server is unreachable
-       (on every error ?)
+VC++ : crashing when there's no configuration file, when server is unreachable,
+       when connection has been interrupted and wants to quit (on every error ?)
 
 [postponed to July:]
 
@@ -83,6 +83,10 @@ wxbRestorePanel : Check more carefully which job we just have run
    
 wxbRestorePanel : Add a timeout when waiting for commands results
 
+bacula-dir : correct director to handle correctly + marked status
+   (In fact there is a bug in the director : If you mark a directory
+   (not a file), and then unmark it, its parents keep the "+" status.)
+
 general : make a good documentation with snapshots
 
 BUGS
index 3e5954698313b8ddad5d73db2feb88d241529536..ede22cd5656a44811604df9c2beb926041cd3cdb 100644 (file)
@@ -80,7 +80,7 @@ void* console_thread::Entry() {
 
    init_stack_dump();
    my_name_is(0, NULL, "wx-console");
-   textdomain("bacula-console");
+   //textdomain("bacula-console");
    init_msg(NULL, NULL);
 
    /* TODO (#4#): Allow the user to choose his config file. */
@@ -99,6 +99,8 @@ void* console_thread::Entry() {
       csprint("Failed to connect to the director\n");
       csprint(NULL, CS_END);
       csprint(NULL, CS_DISCONNECTED);
+      csprint(NULL, CS_TERMINATED);
+      Exit();
       return NULL;
    }
 
@@ -110,6 +112,8 @@ void* console_thread::Entry() {
       csprint(UA_sock->msg);
       csprint(NULL, CS_END);
       csprint(NULL, CS_DISCONNECTED);
+      csprint(NULL, CS_TERMINATED);
+      Exit();
       return NULL;
    }
    
@@ -157,8 +161,12 @@ void* console_thread::Entry() {
    csprint("Connection terminated\n");
    
    UA_sock = NULL;
+
+   csprint(NULL, CS_TERMINATED);
+   
+   Exit();
    
-   return 0;
+   return NULL;
 }
 
 void console_thread::Write(const char* str) {
index 6f762557547e5185eba7bf74487dd66b5d335e15..e4777a32eeba2b4243d2080931000c7f3cfdfa3f 100644 (file)
@@ -32,6 +32,7 @@
 #define CS_CONNECTED     4 /* the socket is now connected */
 #define CS_DISCONNECTED  5 /* the socket is now disconnected */
 #define CS_DEBUG        10 /* used to print debug messages */
+#define CS_TERMINATED   99 /* used to signal that the thread is terminated */
 
 /* function called by console_thread to send events back to the GUI */
 void csprint(char* str, int status=CS_DATA);
index d557cc709f3a40edb4c03beaebf39305bc23822e..520b916797006390a62547f68a11cb88c84f0cc7 100644 (file)
@@ -164,7 +164,7 @@ wxbMainFrame* wxbMainFrame::GetInstance()
  */
 wxbMainFrame::~wxbMainFrame()
 {
-   if ((ct != NULL) && (!ct->IsRunning())) {
+   if (ct != NULL) { // && (!ct->IsRunning())
       ct->Delete();
    }
 }
@@ -325,6 +325,13 @@ void wxbMainFrame::OnPrint(wxbThreadEvent& event) {
  */
 void wxbMainFrame::Print(wxString str, int status)
 {
+   if (status == CS_TERMINATED) {
+      SetStatusText("Console thread terminated.");
+      ct = NULL;
+      DisablePanels();
+      return;
+   }
+   
    if (status == CS_CONNECTED) {
       SetStatusText("Connected to the director.");
       EnablePanels();
index a22c8cd18bdd92775c7b405899d922a5416ef594..34c41f00638694ea76cb1db7d288f074244144f3 100644 (file)
@@ -123,6 +123,8 @@ public:
    /* Unregister a wxbDataParser */
    void Unregister(wxbDataParser* dp);
 
+   console_thread* ct; /* thread interacting with the director */
+
 private:
    /* private constructor, singleton */
    wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style);
@@ -135,8 +137,6 @@ private:
    wxbPanel **panels; /* panels array, contained in the notebook */
    wxbDataParsers parsers; /* Data parsers, which need to receive director informations */
 
-   console_thread* ct; /* thread interacting with the director */
-
    wxbPromptParser* promptparser; /* prompt parser catching uncatched questions */
 
    static wxbMainFrame *frame; /* this */