]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix display of "const" methods in wxGTK assert dialog.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 21 Mar 2012 00:11:12 +0000 (00:11 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 21 Mar 2012 00:11:12 +0000 (00:11 +0000)
Don't separate the function name and its arguments types in 2 different
columns in the assert dialog, this doesn't really work with const methods as
"const" can't be separated from the function like this. The old code just
didn't take "const" into account at all and mangled all the const methods by
showing ") cons" (no typo) at the end.

Just show everything in one column to avoid the problem and also simplify the
code.

Closes #14104.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/gtk/assertdlg_gtk.h
src/gtk/assertdlg_gtk.cpp
src/gtk/utilsgtk.cpp

index 819d20a225e1f10b8200e31f384ed0f10585342a..4f65b5b05c8e536ed94be7efa067a4fcbf83fe26 100644 (file)
@@ -501,6 +501,7 @@ GTK:
 - Implement support for wxBG_STYLE_TRANSPARENT (Armel Asselin).
 - Fix wxNotebook best size calculation.
 - Implement wxDirDialog::Create() and wxFileDialog::Create() (vinayakgarg).
+- Fix const methods display in assert dialog (vinayakgarg).
 
 MSW:
 
index 4842c7c2021f3b9c54f7cdbfbf0b5d397c86fb32..2e1a7a800abb3611b8abaeea5ae6cc050b842386 100644 (file)
@@ -72,7 +72,6 @@ void gtk_assert_dialog_set_backtrace_callback(GtkAssertDialog *assertdlg,
 /* appends a stack frame to the dialog */
 void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg,
                                           const gchar *function,
-                                          const gchar *arguments,
                                           const gchar *sourcefile,
                                           guint line_number);
 
index 4df435b37ef527843b28e3945ad3c2fd9191b333..2a80149a77c61256091ab058745f02038e84976f 100644 (file)
        in gtk_assert_dialog_create_backtrace_list_model() function
  */
 #define STACKFRAME_LEVEL_COLIDX        0
-#define FUNCTION_NAME_COLIDX           1
+#define FUNCTION_PROTOTYPE_COLIDX      1
 #define SOURCE_FILE_COLIDX             2
 #define LINE_NUMBER_COLIDX             3
-#define FUNCTION_ARGS_COLIDX           4
 
 
 
@@ -86,12 +85,11 @@ GtkWidget *gtk_assert_dialog_create_backtrace_list_model ()
     GtkWidget *treeview;
 
     /* create list store */
-    store = gtk_list_store_new (5,
+    store = gtk_list_store_new (4,
                                 G_TYPE_UINT,        /* stack frame number */
-                                G_TYPE_STRING,      /* function name      */
+                                G_TYPE_STRING,      /* function prototype */
                                 G_TYPE_STRING,      /* source file name   */
-                                G_TYPE_STRING,      /* line number        */
-                                G_TYPE_STRING);     /* function arguments */
+                                G_TYPE_STRING);     /* line number        */
 
     /* create the tree view */
     treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL(store));
@@ -100,8 +98,7 @@ GtkWidget *gtk_assert_dialog_create_backtrace_list_model ()
 
     /* append columns */
     gtk_assert_dialog_append_text_column(treeview, "#", STACKFRAME_LEVEL_COLIDX);
-    gtk_assert_dialog_append_text_column(treeview, "Function name", FUNCTION_NAME_COLIDX);
-    gtk_assert_dialog_append_text_column(treeview, "Function args", FUNCTION_ARGS_COLIDX);
+    gtk_assert_dialog_append_text_column(treeview, "Function Prototype", FUNCTION_PROTOTYPE_COLIDX);
     gtk_assert_dialog_append_text_column(treeview, "Source file", SOURCE_FILE_COLIDX);
     gtk_assert_dialog_append_text_column(treeview, "Line #", LINE_NUMBER_COLIDX);
 
@@ -381,7 +378,7 @@ gchar *gtk_assert_dialog_get_message (GtkAssertDialog *dlg)
 
 gchar *gtk_assert_dialog_get_backtrace (GtkAssertDialog *dlg)
 {
-    gchar *function, *arguments, *sourcefile, *linenum;
+    gchar *function, *sourcefile, *linenum;
     guint count;
 
     GtkTreeModel *model;
@@ -399,16 +396,15 @@ gchar *gtk_assert_dialog_get_backtrace (GtkAssertDialog *dlg)
     do
     {
         /* append this stack frame's info to the string */
-        gtk_tree_model_get (model, &iter,
+        gtk_tree_model_get(model, &iter,
                             STACKFRAME_LEVEL_COLIDX, &count,
-                            FUNCTION_NAME_COLIDX, &function,
-                            FUNCTION_ARGS_COLIDX, &arguments,
+                            FUNCTION_PROTOTYPE_COLIDX, &function,
                             SOURCE_FILE_COLIDX, &sourcefile,
                             LINE_NUMBER_COLIDX, &linenum,
                             -1);
 
-        g_string_append_printf (string, "[%u] %s(%s)",
-                                count, function, arguments);
+        g_string_append_printf(string, "[%u] %s",
+                                count, function);
         if (sourcefile[0] != '\0')
             g_string_append_printf (string, " %s", sourcefile);
         if (linenum[0] != '\0')
@@ -416,7 +412,6 @@ gchar *gtk_assert_dialog_get_backtrace (GtkAssertDialog *dlg)
         g_string_append (string, "\n");
 
         g_free (function);
-        g_free (arguments);
         g_free (sourcefile);
         g_free (linenum);
 
@@ -451,7 +446,6 @@ void gtk_assert_dialog_set_backtrace_callback(GtkAssertDialog *assertdlg,
 
 void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg,
                                           const gchar *function,
-                                          const gchar *arguments,
                                           const gchar *sourcefile,
                                           guint line_number)
 {
@@ -474,8 +468,7 @@ void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg,
     gtk_list_store_append (GTK_LIST_STORE(model), &iter);
     gtk_list_store_set (GTK_LIST_STORE(model), &iter,
                         STACKFRAME_LEVEL_COLIDX, count+1,     /* start from 1 and not from 0 */
-                        FUNCTION_NAME_COLIDX, function,
-                        FUNCTION_ARGS_COLIDX, arguments,
+                        FUNCTION_PROTOTYPE_COLIDX, function,
                         SOURCE_FILE_COLIDX, sourcefile,
                         LINE_NUMBER_COLIDX, linenum->str,
                         -1);
index 0d1add821a5f4df361239cfc164b12d5bda2eb89..fefda2bd809223ea5f20c7d8b5876c72c6315382 100644 (file)
@@ -304,25 +304,11 @@ protected:
     virtual void OnStackFrame(const wxStackFrame& frame)
     {
         wxString fncname = frame.GetName();
-        wxString fncargs = fncname;
-
-        size_t n = fncname.find(wxT('('));
-        if (n != wxString::npos)
-        {
-            // remove arguments from function name
-            fncname.erase(n);
-
-            // remove function name and brackets from arguments
-            fncargs = fncargs.substr(n+1, fncargs.length()-n-2);
-        }
-        else
-            fncargs = wxEmptyString;
 
         // append this stack frame's info in the dialog
         if (!frame.GetFileName().empty() || !fncname.empty())
             gtk_assert_dialog_append_stack_frame(m_dlg,
                                                 fncname.mb_str(),
-                                                fncargs.mb_str(),
                                                 frame.GetFileName().mb_str(),
                                                 frame.GetLine());
     }