gtk_window_set_transient_for bug



Greetings, Programs!

    I think I've found a bug in gtkwindow.c in the _set_transient_for
routines.  Basically, if you call gtk_window_set_transient_for() for a
given window, then call it again, it is supposed to remove the previous
transient_parent and set the new parent.  The code here:


       if (window->transient_parent)
         {
           gtk_window_unset_transient_for (window);

           if (GTK_WIDGET_REALIZED (window) &&
        GTK_WIDGET_REALIZED (window->transient_parent) &&
        (!parent || !GTK_WIDGET_REALIZED (parent)))
      gtk_window_transient_parent_unrealized (GTK_WIDGET
     (window->transient_parent),
           GTK_WIDGET (window));
         }

calls gtk_window_unset_transient_for on the window, then checks if the
parent window is unrealized.  The problem here lies in that
gtk_window_unset_transient_for sets window->transient_parent to NULL
*before* the unrealized call.  I've included a patch that moves the
gtk_window_unset_transient_for call after the parent_realized check . .
. seems to work for me (I'm not all that familiar with the gtk
internals, but this was a pretty simple SEGV to find . . .)

Hope this helps.


Lance
  ------------------------------------------------------------------------
  ___                                       Lance Capser
 /\_ \                         Freelance Web Page Designer / Web Master
 \//\ \     ___ ___     ___      / Unix SysAdmin / C,C++ Programmer
   \ \ \  /' __` __`\  /'___\ -----------------------------------------
    \_\ \_/\ \/\ \/\ \/\ \__/
    /\____\ \_\ \_\ \_\ \____\      E-Mail: lmc@cyberhighway.net
    \/____/\/_/\/_/\/_/\/____/          Phone: (208) 461-0222
                                        Pager: (208) 391-0448
  "If DOS had been better in the first place, I might not have started
                          this.- Linus Torvalds


--- gtkwindow.orig	Fri Sep 10 21:23:09 1999
+++ gtkwindow.c	Fri Sep 10 21:24:29 1999
@@ -609,13 +609,13 @@
 
   if (window->transient_parent)
     {
-      gtk_window_unset_transient_for (window);
-      
       if (GTK_WIDGET_REALIZED (window) && 
 	  GTK_WIDGET_REALIZED (window->transient_parent) && 
 	  (!parent || !GTK_WIDGET_REALIZED (parent)))
 	gtk_window_transient_parent_unrealized (GTK_WIDGET (window->transient_parent),
 						GTK_WIDGET (window));
+
+      gtk_window_unset_transient_for (window);
     }
 
   window->transient_parent = parent;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]