Hello all,

I have tried to debug the wxWidgets' and gtk2's code to find out more
about this gtk/codeblocks bug.  The error is very severe because it
freezes the entire GNOME-desktop.

[[ Of course, I should have created a minum-application to demonstrate the 
error but I actually found it easier to debug the codeblocks (IDE) itself. ]]
-----------------------------------------

I did this:

1) Downloaded first the latest gtk+ code from 
http://ftp.gnome.org/pub/GNOME/sources/gtk+/2.10/gtk+-2.10.9.tar.gz
and configured and compiled it with a debug option.

$ cd  gtk+-2.10.9
$ ./configure  --enable-debug=yes 
$ make && sudo make install 
$ sudo ldconfig

2) Downloaded source code for wxGTK-2.6.3 from http://www.wxwidgets.org .
I also tried the pure X11 version of wxWidgets ( wxX11-2.6.3 ), but codeblocks 
refused to compile with it.  Configured and compiled wxGTK-2.6.3 with debug 
options.

$ cd wxGTK-2.6.3

$ ./configure --help | grep deb

$ ./configure  --enable-debug  --enable-debug_gdb 
$ make && sudo make install
$ sudo ldconfig


3) Configured and compiled also codeblocks IDE with debug options
$ cd cb/trunk
$ ./configure --enable-debug --enable-contrib 
$ make && sudo make install
----------------------------------------------

4) Now it was possible to debug trace the entire codeblocks app. 
Started codeblock in the gdb debugger.
$ gdb codeblocks 

The earlier Valgrind findings revealed that it FROZE somewhere nearby
the gdk_keyboard_grab() function in the "gdkmain-x11.c" file.

But because it disables the keyboard (by calling: gdk_keyboard_grab(...)
) before that, so it was best to set a breakpoint at
gtk_drag_begin_internal() function in the "gtkdnd.c" file and carefully
step forward from there.

So the game was set, and I had these breakpoints in the gdb debugger. 
(gdb) b   gtk_drag_begin_internal
(gdb) b   gdk_keyboard_grab
(gdb) r
------------------------------

The code freeze/froze in the gdkmain-x11.c's gdk_keyboard_grab() function.
I had absolutely no idea what's going on there, but the drag & drop's time 
variable was always set to 0. That's odd !  

I modified the code and added a "if (time == 0)..." test.

...
  if (event)
    time = gdk_event_get_time (event);

  /* Check if the event's time is 0. */
  if (time == 0)
  {
    event->dnd.time = time = gtk_get_current_event_time();
  }


  if (gdk_pointer_grab (ipc_widget->window, FALSE,
                        GDK_POINTER_MOTION_MASK |
                        GDK_BUTTON_RELEASE_MASK, NULL,
                        cursor, time) != GDK_GRAB_SUCCESS)
    {
      gtk_drag_release_ipc_widget (ipc_widget);
      return NULL;
    }  

...
---------------------------------------------
And re-compiled the whole gtk mdoule + run sudo ldconfig.

Now the codeblocks IDE's drag & drop works well and it does not freeze
itself or the entire desktop anymore.

Is this a good fix? 
What do you think?

I have reached my coding/debugging limits and need help  o-)
----

The gdk_keyboard_grab(...) function is in gtk+-2.10.9/gtk/gtkdnd.c file. 
See my debugging sample with if-test on the event's "time" variable: 
http://www.edbl.no/tmp/gtkdnd.c

The gtk_drag_begin_internal(...) function is in gtk+-2.10.9/gtk/gtkdnd.c file. 
See my debugging sample: http://www.edbl.no/tmp/gdkmain-x11.c
I added only some debugg fprintf(...) statements, no other code changes !
----

Sincerely
   moma
   http://www.futuredesktop.org

-- 
Crash in applications using wxWidgets2.6.1
https://launchpad.net/bugs/57569

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to