Re: x5250 seg fault

James Rich <[email protected]>
Newsgroups gmane.comp.emulators.tn5250
Message-ID <[email protected]>
On Wed, 20 May 2009, James Rich wrote:

> But no matter.  Following your steps of hightlight -> Edit -> Copy ->
> middle click causes x5250 to crash for me, so at last I can reproduce the
> problem.  Now to find a solution...

And here it is:

--- x5250-0.5.2-pre4/src/x5250.c        2005-11-11 14:13:18.000000000 
-0700
+++ x5250/src/x5250.c   2009-05-20 15:27:21.598297303 -0600
@@ -1451,7 +1451,7 @@
  {
    Tn5250Window *windowlist, *subwindow;
    Atom type_returned;
-  int format_returned;
+  int format_returned = 0;
    unsigned long items_returned;
    unsigned long bytes_remaining;
    unsigned char *data;
@@ -1463,10 +1463,10 @@
    items_returned = 1024;
    bytes_remaining = 0;

-  if (XGetWindowProperty
+  if ((XGetWindowProperty
        (display, win, property, 0, items_returned, True, AnyPropertyType,
         &type_returned, &format_returned, &items_returned, 
&bytes_remaining,
-       &data) == Success)
+       &data) == Success) && (items_returned > 0))
      {
  #ifdef DEBUG
        fprintf (stderr, "got the selection:\n[%s]\n", data);
--- x5250-0.5.2-pre4/src/x5250term.c    2006-01-09 17:06:29.000000000 
-0700
+++ x5250/src/x5250term.c       2007-01-29 13:59:06.000000000 -0700
@@ -2190,9 +2190,30 @@
      }
  #endif

+  /* For some reason terminal->data->row does not contain the right 
values
+   * when pasting on some screens.  So ignore terminal->data->row and 
just
+   * row all the time.
+   * FIXME
+   */
+  /*
+  if (terminal->data->row != row)
+    {
+      printf ("row != terminal->data->row! (%d %d)\n",
+             row, terminal->data->row);
+    }
+  if (terminal->data->column != column)
+    {
+      printf ("column != terminal->data->column! (%d %d)\n",
+             column, terminal->data->column);
+    }
+
    if (is_in_field (terminal->data->row - windowrowoffset,
                    terminal->data->column - windowcolumnoffset,
                    &terminal->data->fieldid))
+  */
+  if (is_in_field (row - windowrowoffset,
+                  column - windowcolumnoffset,
+                  &terminal->data->fieldid))
      {
        c = key;



James Rich

if you want to understand why that is, there are many good books on
the design of operating systems. please pass them along to redmond
when you're done reading them :)
 	- Paul Davis on ardour-dev
-- 
This is the Linux 5250 Development Project (LINUX5250) mailing list
To post a message email: LINUX5250-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/linux5250
or email: LINUX5250-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/linux5250.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.