Le 29/09/2016 à 18:41, Enrico Forestieri a écrit :
On Thu, Sep 29, 2016 at 12:52:02PM +0200, Guillaume Munch wrote:


Thanks for the backtrace. The problem is that the variable BufferView *
bv_ in ViewSourceWidget is a borrowed pointer with unclear lifetime,
i.e. it will dangle. I have decided to get rid of it entirely, but this
requires a few changes to the Dialog architecture and takes some time to
implement (hopefully with bigger benefits). So I pushed a quick fix in
the meantime.

I had arrived to the same conclusion and was pushing the (perhaps simpler)
attached patch, but you beated me ;)


At e0e765f6a98 there is now a proper fix getting rid of the non-sensical
BufferView pointer and simplifying the design a bit. The only reason why
the pointer could not be removed straight away is that it was involved
in a pointer comparison to check whether the bufferview had changed. I
basically moved the control of the widget to the dialog, which knows the
proper pointer.

There is now a virtual function Dialog::on_bufferViewChanged that is
called when the BufferView changes and only then. There were simpler
solutions, but the new signal also helps with some code factoring and
will certainly be useful in the future.

Guillaume

Reply via email to