SNet Router Crash fix

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

SNet Router Crash fix

Stefan Westerfeld
   Hi!

BEAST has been crashing for me in the last git version, should be reproducable
by the following steps:

(1) start beast
(2) load BQS organ instrument
(3) in the snet router, RIGHT click on DavOrgan-1
-> crash

In any case, I tried to fix it myself, and this is the resulting patch:

diff --git a/beast-gtk/bstmenus.cc b/beast-gtk/bstmenus.cc
index a26bda0..1fdb0b5 100644
--- a/beast-gtk/bstmenus.cc
+++ b/beast-gtk/bstmenus.cc
@@ -10,7 +10,7 @@ struct BstChoice {
   Bse::Icon      bseicon;
   String         name;
   void          *p_id;
-  BstChoice() : type_and_flags (BST_CHOICE_TYPE_SEPARATOR), icon_stock_id (NULL), name (NULL), p_id (NULL) {}
+  BstChoice() : type_and_flags (BST_CHOICE_TYPE_SEPARATOR), p_id (NULL) {}
 };
 
 
@@ -136,7 +136,7 @@ bst_choice_menu_add_choice_and_free (GtkWidget *menu,
        gxk_stock_image (choice->icon_stock_id.c_str(), GXK_ICON_SIZE_MENU));
       any = gtk_widget_new (GTK_TYPE_ACCEL_LABEL,
     "visible", TRUE,
-    "label", choice->name,
+    "label", choice->name.c_str(),
     "parent", item,
     "accel_widget", item,
     "xalign", 0.0,
@@ -230,7 +230,7 @@ bst_choice_dialog_createv (BstChoice *first_choice,
   any = gtk_widget_new (GTK_TYPE_LABEL,
  "visible", TRUE,
  "justify", GTK_JUSTIFY_CENTER,
- "label", choice->name,
+ "label", choice->name.c_str(),
  "wrap", FALSE,
  NULL);
   gtk_box_pack_start (GTK_BOX (vbox), any, TRUE, TRUE, 0);
@@ -269,7 +269,7 @@ bst_choice_dialog_createv (BstChoice *first_choice,
  {
   GtkWidget *any;
  case BST_CHOICE_TYPE_TITLE:
-  gtk_widget_set (dialog, "title", choice->name, NULL);
+  gtk_widget_set (dialog, "title", choice->name.c_str(), NULL);
   break;
  case BST_CHOICE_TYPE_ITEM:
   any = gxk_dialog_action_multi (GXK_DIALOG (dialog), choice->name.c_str(),
diff --git a/beast-gtk/bstmenus.hh b/beast-gtk/bstmenus.hh
index 591eee9..705b059 100644
--- a/beast-gtk/bstmenus.hh
+++ b/beast-gtk/bstmenus.hh
@@ -48,7 +48,7 @@ void   bst_choice_destroy  (GtkWidget  *choice);
 #define BST_CHOICE_TEXT(name)            (bst_choice_alloc (BST_CHOICE_TYPE_TEXT, \
     (name), NULL, BST_STOCK_NONE, Bse::Icon()))
 #define BST_CHOICE_SEPERATOR             (bst_choice_alloc (BST_CHOICE_TYPE_SEPARATOR, \
-    NULL, NULL, BST_STOCK_NONE, Bse::Icon()))
+    "", NULL, BST_STOCK_NONE, Bse::Icon()))
 #define BST_CHOICE_END                   (NULL)
 
 
diff --git a/beast-gtk/bstutils.hh b/beast-gtk/bstutils.hh
index 08cbb96..adc4bcb 100644
--- a/beast-gtk/bstutils.hh
+++ b/beast-gtk/bstutils.hh
@@ -183,7 +183,7 @@ BstGMask*       bst_gmask_quick         (GtkWidget     *gmask_container,
 
 
 /* --- stock actions and aliases --- */
-#define BST_STOCK_NONE                  (NULL)
+#define BST_STOCK_NONE                  ("")
 #define BST_STOCK_APPLY                 GTK_STOCK_APPLY
 #define BST_STOCK_CANCEL                GTK_STOCK_CANCEL
 #define BST_STOCK_CDROM                 GTK_STOCK_CDROM

Why this is needed:

All changes I made directly avoid constructing a std::string with NULL as
argument.  In some cases, I had to change NULL to "" to make it work. Even in
case that you cannot reproduce the crash, the changes should still be logically
necessary. (The varargs changes are not from me).

   Cu... Stefan
--
Stefan Westerfeld, http://space.twc.de/~stefan
_______________________________________________
beast mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/beast
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SNet Router Crash fix

Tim Janik-6
Hey Stafen.

On 27.10.2016 16:40, Stefan Westerfeld wrote:
>    Hi!
>
> BEAST has been crashing for me in the last git version, should be reproducable
> by the following steps:
>
> (1) start beast
> (2) load BQS organ instrument
> (3) in the snet router, RIGHT click on DavOrgan-1
> -> crash

Ah, I see it now. I read your last email that right clicking on the router canvas was needed, so it escaped me back then.

> In any case, I tried to fix it myself, and this is the resulting patch:

Great, I'd love to apply.

Can you please commit your changes, add signed-off, and send it as git format-patch, as github pull request or a commit I can cherry pick from stwbeast?
I.e. anything that's a proper commit and preserves your authorship, etc.

--
Yours sincerely,
Tim Janik

https://testbit.eu/timj/
Free software author.
_______________________________________________
beast mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/beast
Loading...