FLTK logo

Re: [fltk/fltk] Fl_Tree handler might refer to a null root causing a crash (Issue #971)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] Fl_Tree handler might refer to a null root causing a crash (Issue #971) erco77 06:14 May 08  
 

Thanks all; wow, that's a sneaky case to clear the root during the recursion to handle(FL_FOCUS).

Doing that second test for _root == NULL shows how this problem can crop up anywhere, so perhaps doing anything directly with _root is inherently dangerous.

Changing _root->find_clicked() to just find_clicked() fixes the problem too, as it does the same operation and includes the check for (_root == NULL) in the method, so that's a cleaner solution, e.g.

-     Fl_Tree_Item *item = _root->find_clicked(_prefs, 0);
+     Fl_Tree_Item *item = find_clicked(0);      // #971

And in fact that pattern should be applied throughout the handle() method wherever _root->find_clicked() is used. I'll try applying that later today; I'm not quite awake yet.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/issues/971/2100550524@github.com>

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.