[Geany-Devel] About Malloc memory for each tab?

Matthew Brush mbrush at xxxxx
Sat Oct 24 00:30:37 UTC 2015

On 15-10-23 09:21 AM, Pengfei Sun wrote:
> Hi Lex,
> I have one question about tab switch in the geany. I know the different tab
> has different doc->id. I think there is only one thread which manages all
> tabs, right?  I wonder when we switch different tabs to edit the document.
> How does geany manage or recognize different tabs? g_main_context_check
> will be called in g_main_loop_run. Whether the data structure GMainContext
> will include some information which can recognize the different tab?


I know you weren't addressing me, but you might want to look into GTK+, 
the event-driven GUI toolkit Geany uses. When user changes a tab, the 
GtkNotebook widget emits a signal telling Geany about the event, and 
then Geany asks the GtkNotebook for the widget contained in the selected 
tab page, which (eventually) contains the Scintilla widget, via the GTK+ 
widget hierarchy.

If you're trying to track down the control flow via GDB or other 
debugger, the event-driven model is going to send you on a wild goose 
chase through hell :)

FWIW, doc->id is basically not very useful, it just tells the index into 
some internal array of GeanyDocument objects, but is not unique to each 
document/tab per se (it gets recycled for new documents and such).

Matthew Brush

More information about the Devel mailing list