gtk-fortran
gtk-fortran copied to clipboard
notebook example freezes when I try to detach tab.
Describe the bug I am using macOS and I found that when I try to detach a tab in the notebooks.f90 example, the UI essentially freezes and I can only close it. None of the other buttons or notebook tabs work after a drag n drop event. I'm guessing this is an issue with my machine or OS, but was hoping to get some confirmation.
Expected behavior If I try to detach a tab that the rest of the UI will work afterwards. Note that as far as I can tell/know, every other example works fine on my machine, so odd to me that this specific thing does now work.
To Reproduce
- Open Notebooks example
- Grab a tab with the mouse (doesn't matter which one)
- Move it either off the window or to the other notebook (doesn't matter to me)
- After doing this the UI will become unresponsive; no buttons will work and you can only close the app.
Here is an example of it frozen after I tried to move page two of the bottom notebook off screen. Note how page two is separated from the other two tabs. At this point no widget on the UI is responsive and I must close the app.
Your system:
- OS version: macOS 12.3.1 (apple silicon/M1)
- Compiler version: fortran 12.0.0 20211218 (experimental)
- GTK branch: gtk4
Additional context I discovered this as I was working on my own UI and I could not figure out why every time I tried to detach a notebook tab that my UI froze. I then checked your example and got the exact same behavior.
Thanks for this precise bug report, and for reporting that other examples are running fine on macOS / M1 !
On my side:
- GFortran 11.2.0, GTK 4.6.5, Linux Kubuntu 22.04: no freeze. I can move the tab to the other notebook. But if I move it off the window, it will finally reappear a few seconds later (sometimes 10 seconds).
- With GTK 3.24.33, nothing happens if I try to move it off the window.
- GFortran 12.1.1, GTK 4.7.0, Linux Fedora Rawhide (37): I can not move it off the window, and I can not move it to the other notebook. The problem looks like https://gitlab.gnome.org/GNOME/gtk/-/issues/4423
See also: https://gitlab.gnome.org/GNOME/gtk/-/issues/?search=gtknotebook&sort=updated_desc&state=opened&first_page_size=20
The freeze problem could be a GTK 4 bug on the macOS implementation.
But I will print and study more deeply the notebooks.f90
example. Sometimes, subtle bugs are revealed on a specific OS.
https://docs.gtk.org/gtk4/class.Notebook.html
Thanks Vincent for the response and the info!
Now I am more convinced that there is some gtk issue; I will file an issue there. FWIW I started to do the implementation based on this article, and only when I was having problems did I realize you had a nice example that also wasn't working either. https://stackoverflow.com/questions/56377755/given-a-gtk-notebook-how-does-one-drag-and-drop-a-page-to-a-new-window
Yes I have been playing around with gtk-4-fortran on macOS for several months now trying to port an old fortran based optical design application to an open source UI package for fun (http://www.ecalculations.com). This is the first issue I have come across that I couldn't find a solution; the work you did to implement and document the interface has been quite useful!
Thanks, Jeremy
On Tue, Jul 19, 2022 at 12:31 PM Vincent Magnin @.***> wrote:
https://docs.gtk.org/gtk4/class.Notebook.html
— Reply to this email directly, view it on GitHub https://github.com/vmagnin/gtk-fortran/issues/260#issuecomment-1189473201, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVX64AR3ZGXVHSVZT7FWMDVU37CRANCNFSM54ALLFYA . You are receiving this because you authored the thread.Message ID: @.***>
Jeremy @jnez137 ,
I have read https://docs.gtk.org/gtk4/class.Notebook.html and https://docs.gtk.org/gtk4/method.Notebook.set_tab_detachable.html I don't think that if we move a tab off the window it should be destroyed. My understanding is that the Drag aNd Drop operation is canceled. Of course, it should not freeze the application! Another great place to obtain help about GTK is the GNOME Discourse.
Your work about that optical design application is interesting. I am curious about what you can achieve.
Also, I am interested if you have comments about the gtk-fortran installation instructions for macOS. I don't know if they are up-to-date.
Thanks for the info! I'll look at the gtk documentation and submit an issue.
Regarding macOS installation, I wrote down one additional thing that I had to do for my M1 mac, which may be different for other macs that use gcc. I had some problems getting PLPlOT to compile with the LLVM/Clang compiler, and had to add these variables to CMAKE as a result:
Add this to Cmakelists.txt
set(CMAKE_CXX_FLAGS "-Wno-implicit-function-declaration")
set(CMAKE_C_FLAGS "-Wno-implicit-function-declaration")
Otherwise the instructions were fine, and I suspect they would have worked fine if I was using gcc.
Thanks, Jeremy
On Wed, Jul 20, 2022 at 4:01 AM Vincent Magnin @.***> wrote:
Jeremy @jnez137 https://github.com/jnez137 ,
I have read https://docs.gtk.org/gtk4/class.Notebook.html and https://docs.gtk.org/gtk4/method.Notebook.set_tab_detachable.html I don't think that if we move a tab off the window it should be destroyed. My understanding is that the Drag aNd Drop operation is canceled. Of course, it should not freeze the application! Another great place to obtain help about GTK is the GNOME Discourse https://discourse.gnome.org/c/platform/5.
Your work about that optical design application is interesting. I am curious about what you can achieve.
Also, I am interested if you have comments about the gtk-fortran installation instructions for macOS https://github.com/vmagnin/gtk-fortran/wiki/Installation#macos. I don't know if they are up-to-date.
— Reply to this email directly, view it on GitHub https://github.com/vmagnin/gtk-fortran/issues/260#issuecomment-1190134074, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVX64HW7HXNEOCY34OJO7DVU7L7NANCNFSM54ALLFYA . You are receiving this because you were mentioned.Message ID: @.***>
Thanks Jeremy for your return, that may be useful for other mac users.
Note that I have added some functionalities in notebooks.f90
yesterday. It works fine with GFortran, but with Intel ifx I had a severe freeze under Linux (the desktop was frozen and I had to kill the process in a terminal screen).
I have tested notebooks.f90
on macOS 12.6, with GFortran 12.2.0 and GTK 4.8.1. I have tried to drop and drag a tab from the upward notebook to the downward notebook, which should work. But on macOS, the example is frozen (but the closing cross works):
% ./notebooks
group name = <group>
(<unknown>:575): GLib-GObject-WARNING **: 17:27:16.436: ../gobject/gsignal.c:2772: instance '0x7f9fe18cd180' has no handler with id '491'
You have exited the GLib main loop, bye, bye...
Thanks for the update! I will submit a bug against gtk 4 for this issue.
On Fri, Sep 30, 2022 at 8:32 AM Vincent Magnin @.***> wrote:
I have tested notebooks.f90 on macOS 12.6, with GFortran 12.2.0 and GTK 4.8.1. I have tried to drop and drag a tab from the upward notebook to the downward notebook, which should work. But on macOS, the example is frozen (but the closing cross works):
% ./notebooks group name =
(
:575): GLib-GObject-WARNING **: 17:27:16.436: ../gobject/gsignal.c:2772: instance '0x7f9fe18cd180' has no handler with id '491' You have exited the GLib main loop, bye, bye... — Reply to this email directly, view it on GitHub https://github.com/vmagnin/gtk-fortran/issues/260#issuecomment-1263722500, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVX64ASGX4Q7QNOEA6KKITWA4BX7ANCNFSM54ALLFYA . You are receiving this because you were mentioned.Message ID: @.***>
GTK 4.10.3 on macOS 12.6.4:
mac@intosh examples % ./notebooks
group name = <group>
2023-04-28 19:18:47.215 notebooks[488:3114] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'There are 0 items on the pasteboard, but 1 drag images. There must be 1 draggingItem per pasteboardItem.'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff811ec1e8b __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff811c1fe48 objc_exception_throw + 48
2 CoreFoundation 0x00007ff811ec1cf2 +[NSException exceptionWithName:reason:userInfo:] + 0
3 AppKit 0x00007ff81524ccf6 -[NSDraggingSession(NSInternal) _initWithPasteboard:draggingItems:clippingRect:source:] + 222
4 AppKit 0x00007ff814d1de54 -[NSCoreDragManager beginDraggingSessionWithItems:fromWindow:withClipRect:event:source:] + 1719
5 AppKit 0x00007ff81507eb27 -[NSView(NSDrag) beginDraggingSessionWithItems:event:source:] + 246
6 libgtk-4.1.dylib 0x000000010ff8f663 _gdk_macos_drag_begin + 217
7 libgtk-4.1.dylib 0x000000010ff98e5a gdk_macos_surface_drag_begin + 252
8 libgtk-4.1.dylib 0x000000010fdb5764 gtk_notebook_motion + 585
9 libgtk-4.1.dylib 0x000000010fcdc4c7 _gtk_marshal_VOID__DOUBLE_DOUBLEv + 153
10 libgobject-2.0.0.dylib 0x000000010f794cd7 _g_closure_invoke_va + 212
11 libgobject-2.0.0.dylib 0x000000010f7aa176 g_signal_emit_valist + 992
12 libgobject-2.0.0.dylib 0x000000010f7aabe4 g_signal_emit + 120
13 libgtk-4.1.dylib 0x000000010fd4501b gtk_event_controller_motion_handle_event + 68
14 libgtk-4.1.dylib 0x000000010fd433eb gtk_event_controller_handle_event + 235
15 libgtk-4.1.dylib 0x000000010fe514f9 gtk_widget_run_controllers + 205
16 libgtk-4.1.dylib 0x000000010fd9eb9e gtk_propagate_event_internal + 301
17 libgtk-4.1.dylib 0x000000010fd9e075 gtk_main_do_event + 2136
18 libgtk-4.1.dylib 0x000000010fe65b14 surface_event + 12
19 libgtk-4.1.dylib 0x000000010ff88b27 _gdk_marshal_BOOLEAN__POINTERv + 122
20 libgtk-4.1.dylib 0x000000010ffc3052 gdk_surface_event_marshallerv + 146
21 libgobject-2.0.0.dylib 0x000000010f794cd7 _g_closure_invoke_va + 212
22 libgobject-2.0.0.dylib 0x000000010f7aa176 g_signal_emit_valist + 992
23 libgobject-2.0.0.dylib 0x000000010f7aabe4 g_signal_emit + 120
24 libgtk-4.1.dylib 0x000000010ffc2648 gdk_surface_handle_event + 313
25 libgtk-4.1.dylib 0x000000010ffaf2e5 _gdk_event_queue_flush + 54
26 libgtk-4.1.dylib 0x000000010ffc32fd gdk_surface_flush_events + 30
27 libgobject-2.0.0.dylib 0x000000010f794cd7 _g_closure_invoke_va + 212
28 libgobject-2.0.0.dylib 0x000000010f7aa176 g_signal_emit_valist + 992
29 libgobject-2.0.0.dylib 0x000000010f7aabe4 g_signal_emit + 120
30 libgtk-4.1.dylib 0x000000010ffb3d06 gdk_frame_clock_flush_idle + 43
31 libglib-2.0.0.dylib 0x00000001103c8c7f g_timeout_dispatch + 67
32 libglib-2.0.0.dylib 0x00000001103cbd87 g_main_context_dispatch + 273
33 libglib-2.0.0.dylib 0x00000001103cc074 g_main_context_iterate + 438
34 libglib-2.0.0.dylib 0x00000001103cc0cc g_main_context_iteration + 55
35 libgio-2.0.0.dylib 0x00000001105bed77 g_application_run + 521
36 notebooks 0x000000010f4f7b55 MAIN__ + 436
37 notebooks 0x000000010f4f7c11 main + 57
38 dyld 0x000000011833c52e start + 462
)
libc++abi: terminating with uncaught exception of type NSException
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0 0x110a198be
#1 0x110a18a9d
[...]
#48 0x10f4f7c10
zsh: abort ./notebooks
Crash when dragging notebook tabs on MacOS
https://gitlab.gnome.org/GNOME/gtk/-/issues/5605
GTK 4.10.3 on MSYS2/Windows 10, with drag and drop:
$ ./notebooks.exe
group name = <group>
Segmentation fault
On macOS 12.7 with GTK 4.12.3, notebooks
does not crash and is not frozen when trying to drag&drop a tab, although the drag&drop does not work.
Hi Vincent,
Sorry for the delay and thanks for letting me know. Not crashing is an improvement and I could at least get the drag and drop working in the windows version of my app. I'll look into this in a few weeks.
Thanks, Jeremy
On Tue, Nov 7, 2023 at 1:07 AM Vincent Magnin @.***> wrote:
On macOS 12.7 with GTK 4.12.3, notebooks does not crash and is not frozen when trying to drag&drop a tab, although the drag&drop does not work.
— Reply to this email directly, view it on GitHub https://github.com/vmagnin/gtk-fortran/issues/260#issuecomment-1798087516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVX64FDK7FN44FUML7YJSLYDH26RAVCNFSM54ALLFYKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZZHAYDQNZVGE3A . You are receiving this because you were mentioned.Message ID: @.***>
On macOS 12.7.4 with GTK 4.14.1, no crash and no freeze, but the drag&drop still not working and printing many of these messages:
(<unknown>:704): Gdk-CRITICAL **: 10:52:12.646: _gdk_macos_surface_update_fullscreen_state: assertion 'GDK_IS_MACOS_SURFACE (self)' failed