Re: A queer problem



On Sun, 13 Aug 2000,  Naba Kumar wrote:

> "Nikhil Bhavadas K." <nijbhav@md5.vsnl.net.in> wrote:
> >
> >	My first problem might be very common. How to force response on a
> >dialog window? A quick look of FAQ did not reveal much details.
> 
>   Use gdk_flush() to force the widget to draw. Or try the function
> gtk_widget_draw() on the dialog box. One of these should work.
> 

> >	A queer problem seen when compiling and running this program is that
> >when you create many dialog windows by clicking on the button, and killed some
> >of them, error messages like
> >> Gtk-CRITICAL **: file gtkprogress.c: line 554 (gtk_progress_set_value):
> >> assertion `GTK_IS_PROGRESS (progress)' failed.
> >
> >> Gtk-WARNING **: invalid cast from `(unknown)' to `GtkProgress'
> >
> >appears. Now when trying to create another dialog window by clicking once more,
> >the program segfaults with the message
> >> Gtk-WARNING **: invalid cast from `GtkDialog' to `GtkProgress'
> >The behavior is unpredictable. Sometimes this occurs when we just move the mouse
> >over the button.   	
> >	What is this `cast' problem? Where have I gone wrong? Or is this some
> >bug? Sorry if the mail has become too long. I just wanted to state my
> >problem clealry.
> >	Thanks!
> >Regards,
> >   Nikhil.
> 
>   I think each time you press the button, you are creating the dialog widget
> with gtk_*_new() and showing it. So, next time you press the button again, The
> dialog widget is again created and I will bet, it has overwritten the previous
> pointer to the dialog widget. Now, say you have two dialogs opened sharing 
> the same pointer memory. Obviously, when you have destroyed the latest dilog
> box and when your application refers to the objects in the dialog box 
> (say the progress bar), it will be referencing to the already destroyed objects.
> That is why gtk is warning you about the invalid pointers.

	But this problem exists only when I include progress bar in my dialog
window. If, for example the dialog window contains two buttons, the problem is
not there. So the problem should be in the way I have implemented the timeout
function. 
 > 
>   You can avoid this by showing the dialog box as modal dialog box. This
> will prevent the user to access the application (except the dialog box).
> 
> regards
> -Naba
>

Regards,
Nikhil.
-- 
"Once a satyâgrahi, always a satyâgrahi"
Nikhil Bhavadâs K. <nikhil@linuxstart.com>
		   <kaplingat@yahoo.com>	





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