[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone.colored-diff: d4b3cf9b667017
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone.colored-diff: d4b3cf9b667017fc7b9ce9fffe9b701e35f9acb3 |
Date: |
Tue, 12 Apr 2011 13:43:12 +0200 (CEST) |
revision: d4b3cf9b667017fc7b9ce9fffe9b701e35f9acb3
date: 2011-04-12T11:03:21
author: Richard Hopkins <address@hidden>
branch: net.venge.monotone.colored-diff
changelog:
Fixed crash from invariant triggered by "mtn asciik"
The recently added invariant in the colorize() method to make sure
we output the correct purpose's was being triggered. However, the
real cause for this being thrown seems to be "C++ temporary object
lifetime" from where the asciik instance is initialized.
In asciik.c, the code used to look roughly like this
asciik graph(colorizer(true, cout));
for (revision iterator)
graph.print(rev);
which means by the time graph.print was being called, and issuing a call
to .colorize() from its colorizer member variable, the colormap inside
colorizer was no longer valid. Presumably because the colorizer instance
being temporary is no longer valid after the "asciik graph(...)";
To fix, bind the colorizer instance to a local variable to extend its
lifetime. eg.
colorizer color(true, cout);
asciik graph(color);
for (revision iterator)
graph.print(rev);
NOTE: I think.
manifest:
format_version "1"
new_manifest [80030bef7bab7bebe3014d7a702bf387cea93b3b]
old_revision [663b1962226c9dacd2f691f957229ecf90ed6365]
patch "src/asciik.cc"
from [5a1eb92c8d5decd0e306c0fd7049f5364bda4b30]
to [542aa7ee7cd8af6b9b41e7f9450d93f7412513c6]
============================================================
--- src/asciik.cc 5a1eb92c8d5decd0e306c0fd7049f5364bda4b30
+++ src/asciik.cc 542aa7ee7cd8af6b9b41e7f9450d93f7412513c6
@@ -390,7 +390,8 @@ CMD(asciik, "asciik", "", CMD_REF(debug)
toposort(db, revs, sorted);
reverse(sorted.begin(), sorted.end());
- asciik graph(std::cout, colorizer(app.opts.colorize, app.lua, std::cout), 10);
+ colorizer color(app.opts.colorize, app.lua, std::cout);
+ asciik graph(std::cout, color , 10);
for (vector<revision_id>::const_iterator rev = sorted.begin();
rev != sorted.end(); ++rev)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone.colored-diff: d4b3cf9b667017fc7b9ce9fffe9b701e35f9acb3,
code <=