Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > CSDb Entries > Release id #187948 : C64 65XE Debugger V0.64.58
2020-05-16 04:33
Slajerek

Registered: May 2015
Posts: 62
Release id #187948 : C64 65XE Debugger V0.64.58

I am using NFD library to open files in Linux. Please guide me how to fix this annoying bug.

https://sourceforge.net/p/c64-debugger/code/ci/master/tree/MTEn..
2020-05-16 15:16
Compyx

Registered: Jan 2005
Posts: 631
Gave this a shot, since I tend to do quite a bit of Gtk stuff.

Note: I haven't used C++ properly for about 15 years, and I'm not familiar with the codebase, so some of my assumptions might be off.

First off: the NFD stuff shouldn't use gtk_init_check(), since you call gtk_init() in Linux/SYS_Startup.cpp. gtk_init_check() doesn't check if gtk_init() was called, it allows you to continue after that call, for example switching to a text interface, gtk_init() will just barf when it cannot initialize Gtk.
Unfortunately that doesn't seem to be the bug.

The 'bug' happens in Gtk3 while calling gtk_file_chooser_new():
Thread 1 "c64debugger" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff68d87bb in __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff68c3535 in __GI_abort () at abort.c:79
#2  0x00007ffff72cadc3 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff7324e1e in g_assertion_message_error ()
    at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007ffff7ab68e5 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#5  0x00007ffff7ab6fe5 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#6  0x00007ffff7ab70a4 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#7  0x00007ffff7ab7288 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#8  0x00007ffff7aca70d in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#9  0x00007ffff7a288d3 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#10 0x00007ffff7a2ca51 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#11 0x00007ffff7acaed3 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#12 0x00007ffff7b87c81 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#13 0x00007ffff7b884b0 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#14 0x00007ffff7b8859e in gtk_widget_get_preferred_width ()
    at /lib/x86_64-linux-gnu/libgtk-3.so.0
#15 0x00007ffff79d78df in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#16 0x00007ffff7a288d3 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#17 0x00007ffff7a2ca51 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#18 0x00007ffff79d83c3 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#19 0x00007ffff7b87c81 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
--Type <RET> for more, q to quit, c to continue without paging--c
#20 0x00007ffff7b884b0 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#21 0x00007ffff7b8859e in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#22 0x00007ffff7b87c81 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#23 0x00007ffff7b884b0 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#24 0x00007ffff7b8859e in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#25 0x00007ffff79d2841 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#26 0x00007ffff7b64396 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#27 0x00007ffff7b87c81 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#28 0x00007ffff7b884b0 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#29 0x00007ffff7b8859e in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#30 0x00007ffff7a288d3 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#31 0x00007ffff7a2ca51 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#32 0x00007ffff7ae44c7 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#33 0x00007ffff7b87c81 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#34 0x00007ffff7b884b0 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#35 0x00007ffff7b8859e in gtk_widget_get_preferred_width () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#36 0x00007ffff7ae41dd in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#37 0x00007ffff7a288d3 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#38 0x00007ffff7a2ca51 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#39 0x00007ffff7ae4350 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#40 0x00007ffff7a288d3 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#41 0x00007ffff7a2ca51 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#42 0x00007ffff7ae446a in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#43 0x00007ffff7b87d4b in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#44 0x00007ffff7b884b0 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#45 0x00007ffff7b879b1 in gtk_widget_get_preferred_height () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#46 0x00007ffff7c29adf in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#47 0x00007ffff7c2a075 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#48 0x00007ffff73e6ecb in g_object_set_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#49 0x00007ffff73e779c in g_object_set () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#50 0x00007ffff7b725e0 in gtk_scrolled_window_set_hadjustment () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#51 0x00007ffff73e48f9 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#52 0x00007ffff73e5fad in g_object_newv () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#53 0x00007ffff79df0c2 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#54 0x00007ffff79e1b93 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#55 0x00007ffff7300553 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#56 0x00007ffff730163d in g_markup_parse_context_parse () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#57 0x00007ffff79e2576 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#58 0x00007ffff79dd3e4 in gtk_builder_extend_with_template () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#59 0x00007ffff7c3ed07 in gtk_widget_init_template () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#60 0x00007ffff7a85c9b in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#61 0x00007ffff7402107 in g_type_create_instance () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#62 0x00007ffff73e4548 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#63 0x00007ffff73e5fad in g_object_newv () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#64 0x00007ffff79df0c2 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#65 0x00007ffff79e06b5 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#66 0x00007ffff79e215d in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#67 0x00007ffff73006b2 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#68 0x00007ffff73017f6 in g_markup_parse_context_parse () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#69 0x00007ffff79e2576 in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#70 0x00007ffff79dd3e4 in gtk_builder_extend_with_template () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#71 0x00007ffff7c3ed07 in gtk_widget_init_template () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#72 0x00007ffff7a7d3ce in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#73 0x00007ffff7402107 in g_type_create_instance () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#74 0x00007ffff73e4548 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#75 0x00007ffff73e63d4 in g_object_new_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#76 0x00007ffff73e6709 in g_object_new () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#77 0x00007ffff7a7dea4 in gtk_file_chooser_dialog_new () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#78 0x0000555555af5fef in NFD_OpenDialog ()
#79 0x00005555557cf880 in SYS_DialogOpenFile(CSystemFileDialogCallback*, std::__cxx11::list<CSlrString*, std::allocator<CSlrString*> >*, CSlrString*, CSlrString*) ()
#80 0x000055555570cd26 in CViewC64::ShowDialogOpenFile(CSystemFileDialogCallback*, std::__cxx11::list<CSlrString*, std::allocator<CSlrString*> >*, CSlrString*, CSlrString*) ()
#81 0x00005555556c91fa in CViewMainMenu::OpenDialogInsertD64() ()
#82 0x0000555555707f4f in CViewC64::ProcessGlobalKeyboardShortcut(unsigned int, bool, bool, bool) ()
#83 0x000055555570a9a5 in CViewC64::KeyDown(unsigned int, bool, bool, bool) ()
#84 0x000055555567e6c6 in CGuiMain::KeyDown(unsigned int, bool, bool, bool) ()
#85 0x0000555555b843e1 in main ()
(gdb) 

As you can see, Gtk fails to get a proper size for its dialog and aborts.

I suspect this is due to threading, since I wrote a small test case using a single thread (basically a main() that calls gtk_init() and then gtk_file_chooser_dialog_new() and then calling gtk_dialog_run(), just like what NFD does). That works.

I have noticed that Gtk (and Qt) can be a little difficult when using threads, they prefer their own threading models, so it could be any non-main thread cannot access the GMainLoop and thus gtk code cannot get the info it requires.

I tried getting a GdkWindow from the X11 Window, or spawning a temporary GtkWindow as a parent for the NFD code, so I could push the dialog to front, that didn't work, still same abort. (GtkWindow doesn't even show, but my taskbar indicates its there).

So, I suspect supporting Gtk3 dialogs will involve a little more code than that NFD 'lib'. You'd probably want to at least have a proper GMainLoop which gets updated in the main thread whenever there's time left in a frame.
(Something similar is happening with VICE now).

Sorry I can't be of more help, but perhaps this helps a little to track down the bugs.
2020-05-17 04:20
Slajerek

Registered: May 2015
Posts: 62
Bow Compyx :)

I saw this on my valgrind and gdb. I've thought that I can just make my own GTK thread, I do not want to stick to that GMainLoop to not create overhead of users who already complained about the speed of this tool :) i.e. we need to optimise this. But maybe running a simple GMainLoop would be the real solution here. Will try, thanks for the hint :)

I've seen alternate method of throwing UI file select dialog to the user via bash. Maybe that's a solution too.
2020-05-17 18:12
Compyx

Registered: Jan 2005
Posts: 631
Im fine with using the non-Gtk3 dialogs. Though perhaps they could use the cwd as their directory and allow keyboard navigation.
2020-05-17 18:25
chatGPZ

Registered: Dec 2001
Posts: 11108
But they dont look native! How dare you!
2020-05-17 18:59
Compyx

Registered: Jan 2005
Posts: 631
They might look native on my Gtk3 Cinnamon desktop, didn't get that far yet. Not my problem you use Motif or Xaw or Tk, some of us like to get with the time, apart from the C64.
2020-05-17 19:06
chatGPZ

Registered: Dec 2001
Posts: 11108
But emu with non native file open dialog is unusable!
2020-05-17 19:35
Compyx

Registered: Jan 2005
Posts: 631
At least the non-native stuff works. Have you tried the flathub or the snap packages? It's bollocks.

They use the GtkFileChooserNative (https://developer.gnome.org/gtk3/stable/gtk3-GtkFileChooserNati..)

That blows.
2020-05-25 12:26
Mace

Registered: May 2002
Posts: 1799
I reckon credits for Slammer/Turtles are wrong.
Probably should be Slammer/Camelot, right?
2020-05-25 13:04
iAN CooG

Registered: May 2002
Posts: 3132
credit corrected
2020-05-26 11:43
Slajerek

Registered: May 2015
Posts: 62
Thanks. I filled a bug at NFD here:
https://github.com/mlabbe/nativefiledialog/issues/84

I tried to debug it on my own and understand the issue, the problem is it does not crash at all on my Debian Jessie, which is a bit tricky to debug then :)

Note, that you can always change dialogs to my own implementation anyway in Settings/UI/Use system dialogs, just set to "No" and instead of GTK you'll see my own simple open/save file dialogs.

Btw. I used gtk_file_chooser_dialog_new in my previous GTK dialogs implementation, but apparently it locked whole app badly. That was probably also due to missing GMainLoop. I've seen a possibility to create our own GMainLoop temporarily and was using that trick (i.e. so the event loop was set to that temporary one just for the time when dialog was opened), which worked OK on some older systems, but not now anymore.

I guess I need to change NFD GTK dialogs to also allow Zenity implementation and make these GTK system dialogs not set as default. Anyway, thanks again for your help.
 
... 15 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Rebok/BOOM!/Tropyx
QuasaR/CENTRiC
Board Rider/Commodor..
aeeben
WVL/Xenon
The MeatBall
Trash
Jucke
Guests online: 135
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Original Suppliers
1 Derbyshire Ram  (9.5)
2 Black Beard  (9.4)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Irata  (8.5)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.069 sec.