[LDTP-Dev] [PATCH] fix for appmap when dialog name is empty

A Nagappan anagappan at novell.com
Wed Oct 12 22:01:07 PDT 2005


Hi Prashanth,
  This patch looks fine. Let me checkin to CVS.

Thanks
Nagappan

Nagappan A <anagappan at novell.com>
Linux Desktop Testing Project - http://gnomebangalore.org/ldtp
http://nagappanal.blogspot.com

>>> Prashanth Mohan <prashmohan at gmail.com> 10/12/05 5:36 PM >>>
Hi

attached is the patch for appmap-gen.c which causes appmap to crash
(segmentation fault) when the title of the dialog box is empty. Faced
this problem when automating gaim.. and nags actually solved this ;-)

Thanks
Prashanth Mohan

Index: appmap-gen.c
===================================================================
RCS file: /cvs/ldtp/appmap/appmap-gen.c,v
retrieving revision 1.8
diff -u -p -r1.8 appmap-gen.c
--- appmap-gen.c        11 Oct 2005 11:36:48 -0000      1.8
+++ appmap-gen.c        12 Oct 2005 12:01:20 -0000
@@ -747,12 +747,17 @@ void insert_context_header (FILE *fp, Ac
       else
        stripped_data = g_strdup (label);
       if (strchr (stripped_data, '.'))
-       tmp_data = strip_delim (stripped_data, '.');
+       tmp_data = strip_delim (stripped_data, '.');
       else
        tmp_data = g_strdup (stripped_data);
       name = g_strdup_printf ("%s%s", cur_obj_info->prefix, tmp_data);
       g_free (tmp_data);
       g_free (stripped_data);
+      g_free (label);
+      g_free (cur_obj_info->object_type);
+      g_free (cur_obj_info->prefix);
+      g_free (cur_obj_info);
+
     }
   else
     {
@@ -760,7 +765,6 @@ void insert_context_header (FILE *fp, Ac
        * TODO: Handle the case of window label being NULL
        */
       g_print ("Found window with label value as NULL!!");
-      g_free (label);
       g_free (object_record);
       g_free (cur_obj_info->object_type);
       g_free (cur_obj_info->prefix);
@@ -770,12 +774,8 @@ void insert_context_header (FILE *fp, Ac
   size = strlen (object_record);
   fwrite (object_record, sizeof (char), size, fp);

-  g_free (label);
   g_free (name);
   g_free (object_record);
-  g_free (cur_obj_info->object_type);
-  g_free (cur_obj_info->prefix);
-  g_free (cur_obj_info);
 }

 void create_appmap (FILE *fp, Accessible *accessible, char
*application_name)


Index: ChangeLog
===================================================================
RCS file: /cvs/ldtp/appmap/ChangeLog,v
retrieving revision 1.6
diff -u -p -r1.6 ChangeLog
--- ChangeLog   11 Oct 2005 11:36:48 -0000      1.6
+++ ChangeLog   12 Oct 2005 12:01:30 -0000
@@ -1,3 +1,5 @@
+2005-10-12 Prashanth Mohan <prashmohan at gmail.com>
+       * Fixed crash, when dialog name is empty
 2005-10-11 Nagappan A <anagappan at novell.com>
        * Fixed SPI leaks in get_relation_name
 2005-10-11 Premkumar J <jpremkumar at novell.com>
_______________________________________________
Ldtp-dev mailing list
Ldtp-dev at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev



More information about the Ldtp-dev mailing list