After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 311187 - GtkFileChooser creates ghost entries and thus plenty of applications misbehave
GtkFileChooser creates ghost entries and thus plenty of applications misbehave
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
2.10.x
Other Linux
: Immediate blocker
: 2.12.0
Assigned To: Federico Mena Quintero
gtk-bugs
: 300221 310554 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-07-21 20:56 UTC by Ali Akcaagac
Modified: 2005-07-27 18:05 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
gedit-311187.diff (6.28 KB, patch)
2005-07-22 02:10 UTC, Federico Mena Quintero
none Details | Review

Description Ali Akcaagac 2005-07-21 20:56:52 UTC
I saw this happening with Gedit and Gimp and initially with Gedit I assumed this
to be a different issue so I filed exactly this bugreport:

http://bugzilla.gnome.org/show_bug.cgi?id=310554

But as I do believe this is mroe an internal issue with GtkFileChooser from GTK+
head. The issues with Gimp has been seen for many months now as well as many
months the same issues with Gedit (which reasons I understood today).

Is it possible for you people to have a look on above bugreport and/or move that
report to become a GTK+ one ?
Comment 1 Federico Mena Quintero 2005-07-21 21:09:41 UTC
I can't reproduce it with today's GTK+ and Gedit.

Which "ghost entries" do you mean?

Note that I broke Save mode inadvertently on 2005/07/14, which is close to the
date of your bug report (timezones?).  I fixed it the next day.

Could you please try with an updated GTK+ HEAD?

What is the exact series of steps needed to reproduce this on your machine?
Comment 2 Paolo Borelli 2005-07-21 21:18:11 UTC
*** Bug 310554 has been marked as a duplicate of this bug. ***
Comment 3 Ali Akcaagac 2005-07-21 21:26:53 UTC
Well my GNOME is from yesterday 20.07.2005 GTK+ HEAD, GNOME HEAD, GEDIT HEAD,
GIMP HEAD and well whatever HEAD :) but this issue is there for months and only
appears on strange occasions. Seems like it needs to get triggered somehow.

What I mean by "ghost entries" are this:

http://bugzilla.gnome.org/attachment.cgi?id=49538&action=view

As you can see in the above attachment (please refer to the Gedit Bugreport)
GtkFileChooser shows two entries of the same file. But only one file is saved in
the directory. Checked up in console with MC and through ls.

To exactly reproduce this all you need to do (at least here it's the case) is to
run Gedit, type in some trash and then simply "save as" and press "save". No
filename changes nothing and make sure to use "save as" (I haven't tested this
with "save". Then press "save as" again once saved and do expand the dirlister.
I always get two entries of "Unnamed Document 1" here. Of course when deleting
them it's ok again.

Also look here, and this is really hard to trigger:

http://bugzilla.gnome.org/attachment.cgi?id=49542&action=view

Files from my homedir once you work with Gimp for quite some time, that is going
through different dirs, do some load/save operations there and here will then
magically show you stuff like this.

http://bugzilla.gnome.org/attachment.cgi?id=49541&action=view

Never seen my "Desktop" dir and my "Screenshot*" files showing up under root. Of
course these files and dir's aren't there but GtkFileChooser show them up there.
That's strange, isn't it ? That's now the 4th time I get this behavior with Gimp
(also with other files, this is just an enforced try to check this behavior). I
got this some months ago the first time (half a year or so, dunno) then again
one day (but restarting Gimp solved this) and now after I saw the same stuff to
be valid with Gedit I clicked around like mad with Gimp's GtkFileChooser,
copied, saved, loaded etc. over and over again between my homedir, tempdir and
some other dirs and then it has occoured again, that stuff shown up magically on
places where they shouldn't.. This will also make the GtkFileChooser become
unusable, since it then doesn't allow saving, loading etc. anymore due to weird
entries. You need to quit the application to get the behavior corrected again.
Comment 4 Federico Mena Quintero 2005-07-21 22:19:03 UTC
Woah, this happens after I get a bunch of warnings from the second "save as"
dialog.  Looks like a FolderVFS is getting corrupted; it has an invalid type
identifier.
Comment 5 Federico Mena Quintero 2005-07-21 22:20:11 UTC
Steps to reproduce this:

1. open gedit
2. type something
3. File/Save as
4. hit Save (it will save to "Untitled Document 1")
5. type something else
6. File/Save as
7. hit Save

you get a bunch of warnings then.
Comment 6 Ali Akcaagac 2005-07-21 22:26:06 UTC
Confirmed! Yes, I think it's now time to forward this to the gnome-vfs people :)
I also hope that this solves the Gimp issue.

galaxy@ulixys:~ > gedit

(gedit:3288): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in
cast to `GtkFileFolder'

(gedit:3288): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in
cast to `GtkFileFolderGnomeVFS'

(gedit:3288): GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT
(object)' failed

(gedit:3288): GLib-GObject-CRITICAL **: g_object_ref: assertion `G_IS_OBJECT
(object)' failed

(gedit:3288): GLib-GObject-WARNING **: instance of invalid non-instantiatable
type `(null)'

(gedit:3288): GLib-GObject-CRITICAL **: g_signal_handlers_disconnect_matched:
assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(gedit:3288): GLib-GObject-WARNING **: instance of invalid non-instantiatable
type `(null)'

(gedit:3288): GLib-GObject-CRITICAL **: g_signal_handlers_disconnect_matched:
assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(gedit:3288): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT
(object)' failed

(gedit:3288): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT
(object)' failed

(gedit:3288): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in
cast to `GObject'

(gedit:3288): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT
(object)' failed
galaxy@ulixys:~ >

Comment 7 Federico Mena Quintero 2005-07-21 23:21:58 UTC
*** Bug 300221 has been marked as a duplicate of this bug. ***
Comment 8 Federico Mena Quintero 2005-07-21 23:22:55 UTC
Bug #300221 identifies why this happens; it happens with filenames with spaces.
 Thanks a LOT to Sebastien for finding this bug for me :)
Comment 9 Federico Mena Quintero 2005-07-22 01:08:13 UTC
Indeed it happens with spaces.  All the places in gtkfilesystemgnomevfs.c insert
canonical and escaped URIs in the folder_vfs->children hash tables, except for
the one in this trace:

  • #0 lookup_folder_child_from_uri
    at gtkfilesystemgnomevfs.c line 2378
  • #1 lookup_folder_child
    at gtkfilesystemgnomevfs.c line 2399
  • #2 gtk_file_folder_gnome_vfs_get_info
    at gtkfilesystemgnomevfs.c line 2448
  • #3 IA__gtk_file_folder_get_info
    at gtkfilesystem.c line 937
  • #4 show_and_select_paths
    at gtkfilechooserdefault.c line 5060
  • #5 pending_select_paths_process
    at gtkfilechooserdefault.c line 5123
  • #6 browse_files_model_finished_loading_cb
    at gtkfilechooserdefault.c line 5178
  • #7 IA__g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 77
  • #8 IA__g_closure_invoke
    at gclosure.c line 603
  • #9 signal_emit_unlocked_R
    at gsignal.c line 2508
  • #10 IA__g_signal_emit_valist
    at gsignal.c line 2267
  • #11 IA__g_signal_emit
    at gsignal.c line 2311
  • #12 root_folder_finished_loading_cb
    at gtkfilesystemmodel.c line 679
  • #13 IA__g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 77
  • #14 IA__g_closure_invoke
    at gclosure.c line 603
  • #15 signal_emit_unlocked_R
    at gsignal.c line 2508
  • #16 IA__g_signal_emit_valist
    at gsignal.c line 2267
  • #17 IA__g_signal_emit_by_name
    at gsignal.c line 2335
  • #18 directory_load_callback
    at gtkfilesystemgnomevfs.c line 2875
  • #19 dispatch_load_directory_callback
    at gnome-vfs-job.c line 237
  • #20 dispatch_job_callback
    at gnome-vfs-job.c line 562
  • #21 g_idle_dispatch
    at gmain.c line 3813
  • #22 g_main_dispatch
    at gmain.c line 1934
  • #23 IA__g_main_context_dispatch
    at gmain.c line 2484
  • #24 g_main_context_iterate
    at gmain.c line 2565
  • #25 IA__g_main_loop_run
    at gmain.c line 2769
  • #26 IA__gtk_dialog_run
    at gtkdialog.c line 1019
  • #27 run_file_selector
    at gedit-file-selector-util.c line 468
  • #28 gedit_file_selector_save
    at gedit-file-selector-util.c line 565
  • #29 gedit_file_save_as
    at gedit-file.c line 371

(note the unescaped "hola mundo" in the first frame)

I'm trying to see why this happens.
Comment 10 Federico Mena Quintero 2005-07-22 02:10:49 UTC
Created attachment 49549 [details] [review]
gedit-311187.diff

This is actually a gedit bug.  It's passing unescaped URIs to
gtk_file_chooser_set_uri(), which causes the file chooser to end up with two
entries in a hash table that should actually be one.  This patch fixes this and
simplifies the gedit code a bit.
Comment 11 Federico Mena Quintero 2005-07-25 15:40:00 UTC
Is the patch above okay to commit?
Comment 12 Paolo Maggi 2005-07-27 13:02:09 UTC
Federico: I and pbor have just finished to review this patch. 

I'm going to test and commit it just now.


Comment 13 Paolo Maggi 2005-07-27 13:24:05 UTC
Tested and committed. Thanks Federico.

2005-07-27  Federico Mena Quintero  <federico@ximian.com>
 
 	Fixes bug #311187:
 
 	* gedit-file-selector-util.c (gedit_file_selector_save): Take a
 	full URI instead of a basename for "default_filename"; actually,
 	renamed this argument to "default_uri".
 	(run_file_selector): Likewise.
 	(create_gtk_selector): Likewise.  Also, just call
 	gtk_file_chooser_set_uri() with the default_uri if it is
 	available.
 
 	* gedit-file.c (gedit_file_save_as): Use the document's raw URI if
 	we already have it and it is a file:/// URI --- don't split into
 	dirname and basename.
Comment 14 Federico Mena Quintero 2005-07-27 18:05:24 UTC
OK, thanks for committing it :)