[haiku-commits] haiku: hrev50387 - src/apps/debugger/user_interface/report src/apps/debugger/user_interface/gui src/kits/debugger/target_host_interface headers/private/debugger/user_interface src/apps/debugger/user_interface/cli

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 3 Jul 2016 19:54:21 +0200 (CEST)

hrev50387 adds 1 changeset to branch 'master'
old head: 4221d035d8a79126de0b05e3aa6804a05961447a
new head: 05fc1277c47440dc36134816d70e5723c99cfcd2
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=05fc1277c474+%5E4221d035d8a7

----------------------------------------------------------------------------

05fc1277c474: Debugger: Fix team restart request.
  
  UserInterface:
  - Add Clone() function to set of required virtuals. This asks the subclass
    to create a new instance of its respective type.
  
  {CommandLine,Graphical,Report}UserInterface:
  - Implement the above function.
  
  TeamDebugger:
  - Add accessor for the currently active UI.
  
  TargetHostInterface:
  - Set correct request type when setting up the options for a team restart.
  - Ask the TeamDebugger for its user interface and clone it in order to fill
    in that aspect of the debug options. This fixes a regression introduced in
    commit 880a64, which inadvertently resulted in team restarts no longer
    working.

                                         [ Rene Gollent <rene@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev50387
Commit:      05fc1277c47440dc36134816d70e5723c99cfcd2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=05fc1277c474
Author:      Rene Gollent <rene@xxxxxxxxxxx>
Date:        Sun Jul  3 17:47:32 2016 UTC

----------------------------------------------------------------------------

9 files changed, 54 insertions(+), 6 deletions(-)
headers/private/debugger/controllers/TeamDebugger.h      |  2 ++
headers/private/debugger/user_interface/UserInterface.h  |  7 +++++++
.../user_interface/cli/CommandLineUserInterface.cpp      |  7 +++++++
.../user_interface/cli/CommandLineUserInterface.h        |  4 +++-
.../user_interface/gui/GraphicalUserInterface.cpp        |  9 ++++++++-
.../debugger/user_interface/gui/GraphicalUserInterface.h |  4 +++-
.../user_interface/report/ReportUserInterface.cpp        | 11 ++++++++++-
.../debugger/user_interface/report/ReportUserInterface.h |  4 +++-
.../target_host_interface/TargetHostInterface.cpp        | 12 +++++++++++-

----------------------------------------------------------------------------

diff --git a/headers/private/debugger/controllers/TeamDebugger.h 
b/headers/private/debugger/controllers/TeamDebugger.h
index c1056ce..f4b2258 100644
--- a/headers/private/debugger/controllers/TeamDebugger.h
+++ b/headers/private/debugger/controllers/TeamDebugger.h
@@ -66,6 +66,8 @@ public:
                                                                        { 
return fCommandLineArgv; }
                        SettingsManager*        GetSettingsManager() const
                                                                        { 
return fSettingsManager; }
+                       UserInterface*          GetUserInterface() const
+                                                                       { 
return fUserInterface; }
 
        virtual void                            MessageReceived(BMessage* 
message);
 
diff --git a/headers/private/debugger/user_interface/UserInterface.h 
b/headers/private/debugger/user_interface/UserInterface.h
index 53f6a5b..17a7a16 100644
--- a/headers/private/debugger/user_interface/UserInterface.h
+++ b/headers/private/debugger/user_interface/UserInterface.h
@@ -56,6 +56,13 @@ public:
                                                                        // shut 
down the UI *now* -- no more user
                                                                        // 
feedback
 
+       virtual UserInterface*          Clone() const = 0;
+                                                                       // 
returns a new instance of the
+                                                                       // 
appropriate user interface subclass.
+                                                                       // 
primarily needed in order to
+                                                                       // 
reconstruct the necessary information
+                                                                       // for 
initiating a team restart.
+
        virtual bool                            IsInteractive() const = 0;
 
        virtual status_t                        LoadSettings(const 
TeamUiSettings* settings)
diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp 
b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp
index 47027d2..28eefbf 100644
--- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp
+++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.cpp
@@ -166,6 +166,13 @@ CommandLineUserInterface::Terminate()
 }
 
 
+UserInterface*
+CommandLineUserInterface::Clone() const
+{
+       return new(std::nothrow) CommandLineUserInterface;
+}
+
+
 bool
 CommandLineUserInterface::IsInteractive() const
 {
diff --git a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h 
b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h
index e908e2d..c6d68ac 100644
--- a/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h
+++ b/src/apps/debugger/user_interface/cli/CommandLineUserInterface.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2015, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2011-2016, Rene Gollent, rene@xxxxxxxxxxx.
  * Copyright 2012, Ingo Weinhold, ingo_weinhold@xxxxxx.
  * Distributed under the terms of the MIT License.
  */
@@ -31,6 +31,8 @@ public:
                                                                        // shut 
down the UI *now* -- no more user
                                                                        // 
feedback
 
+       virtual UserInterface*          Clone() const;
+
        virtual bool                            IsInteractive() const;
 
        virtual status_t                        LoadSettings(const 
TeamUiSettings* settings);
diff --git a/src/apps/debugger/user_interface/gui/GraphicalUserInterface.cpp 
b/src/apps/debugger/user_interface/gui/GraphicalUserInterface.cpp
index 1ff85e9..a6e50af 100644
--- a/src/apps/debugger/user_interface/gui/GraphicalUserInterface.cpp
+++ b/src/apps/debugger/user_interface/gui/GraphicalUserInterface.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxx.
- * Copyright 2011-2014, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2011-2016, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 
@@ -194,6 +194,13 @@ GraphicalUserInterface::Terminate()
 }
 
 
+UserInterface*
+GraphicalUserInterface::Clone() const
+{
+       return new(std::nothrow) GraphicalUserInterface;
+}
+
+
 bool
 GraphicalUserInterface::IsInteractive() const
 {
diff --git a/src/apps/debugger/user_interface/gui/GraphicalUserInterface.h 
b/src/apps/debugger/user_interface/gui/GraphicalUserInterface.h
index c86436f..d031fb3 100644
--- a/src/apps/debugger/user_interface/gui/GraphicalUserInterface.h
+++ b/src/apps/debugger/user_interface/gui/GraphicalUserInterface.h
@@ -1,6 +1,6 @@
 /*
  * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxx.
- * Copyright 2014-2015, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2014-2016, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 #ifndef GRAPHICAL_USER_INTERFACE_H
@@ -30,6 +30,8 @@ public:
                                                                        // shut 
down the UI *now* -- no more user
                                                                        // 
feedback
 
+       virtual UserInterface*          Clone() const;
+
        virtual bool                            IsInteractive() const;
 
        virtual status_t                        LoadSettings(const 
TeamUiSettings* settings);
diff --git a/src/apps/debugger/user_interface/report/ReportUserInterface.cpp 
b/src/apps/debugger/user_interface/report/ReportUserInterface.cpp
index 57fcdf7..d0dfda0 100644
--- a/src/apps/debugger/user_interface/report/ReportUserInterface.cpp
+++ b/src/apps/debugger/user_interface/report/ReportUserInterface.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2015-2016, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 
@@ -84,6 +84,15 @@ ReportUserInterface::Terminate()
 }
 
 
+UserInterface*
+ReportUserInterface::Clone() const
+{
+       // the report interface does not support cloning, since
+       // it won't ever be asked to interactively restart.
+       return NULL;
+}
+
+
 bool
 ReportUserInterface::IsInteractive() const
 {
diff --git a/src/apps/debugger/user_interface/report/ReportUserInterface.h 
b/src/apps/debugger/user_interface/report/ReportUserInterface.h
index 8b06d30..23ba082 100644
--- a/src/apps/debugger/user_interface/report/ReportUserInterface.h
+++ b/src/apps/debugger/user_interface/report/ReportUserInterface.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2015-2016, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 #ifndef REPORT_USER_INTERFACE_H
@@ -27,6 +27,8 @@ public:
        virtual void                            Show();
        virtual void                            Terminate();
 
+       virtual UserInterface*          Clone() const;
+
        virtual bool                            IsInteractive() const;
 
        virtual status_t                        LoadSettings(const 
TeamUiSettings* settings);
diff --git a/src/kits/debugger/target_host_interface/TargetHostInterface.cpp 
b/src/kits/debugger/target_host_interface/TargetHostInterface.cpp
index d4034f3..85b3d09 100644
--- a/src/kits/debugger/target_host_interface/TargetHostInterface.cpp
+++ b/src/kits/debugger/target_host_interface/TargetHostInterface.cpp
@@ -184,13 +184,23 @@ TargetHostInterface::MessageReceived(BMessage* message)
 
                TeamDebugger* debugger = FindTeamDebugger(teamID);
 
+               UserInterface* userInterface = 
debugger->GetUserInterface()->Clone();
+               if (userInterface == NULL)
+                       break;
+
+               BReference<UserInterface> userInterfaceReference(userInterface, 
true);
+
                TeamDebuggerOptions options;
+               options.requestType = TEAM_DEBUGGER_REQUEST_CREATE;
                options.commandLineArgc = debugger->ArgumentCount();
                options.commandLineArgv = debugger->Arguments();
                options.settingsManager = debugger->GetSettingsManager();
+               options.userInterface = userInterface;
                status_t result = StartTeamDebugger(options);
-               if (result == B_OK)
+               if (result == B_OK) {
+                       userInterfaceReference.Detach();
                        debugger->PostMessage(B_QUIT_REQUESTED);
+               }
                break;
        }
        default:


Other related posts:

  • » [haiku-commits] haiku: hrev50387 - src/apps/debugger/user_interface/report src/apps/debugger/user_interface/gui src/kits/debugger/target_host_interface headers/private/debugger/user_interface src/apps/debugger/user_interface/cli - anevilyak