There must surely be some subjects that authors approach with trepidation. Val McDermid’s latest crime novel is about a particularly nasty misogynistic internet troll who isn’t just a sinister online pest; he is also a brutal killer. To tackle this dark and very current subject seems daring, perhaps risky. One assumes as a vocal feminist McDermid must get her own share of abuse online and over social media – after all, what high-profile woman doesn’t? Doesn’t she worry that it might bring on more? Actually, it seems not. Indeed, McDermid is perplexed by the fact that she has barely been trolled at all. “I’m not sure why,” she says, as she sits down outside a tent at the Edinburgh International Book Festival. “Kirsty Wark did a programme last year in which she analysed the way in which women who appeared on Question Time were treated, and I’ve been on the show and I think I’ve got two nasty messages.” Her 14-year-old son, she says, has a theory. “He thinks people are too frightened to take me on.” She laughs. “It’s not the sort of thing that you want your child to say about you.”

Of course, in person McDermid isn’t scary. She is so warmly, deftly funny that you imagine if she hadn’t been an author, she could have carved a career as a stand-up. And perhaps that is a little frightening in itself, the sharpness of wit, combined with the knowledge that this is someone who has published 30 books, many of them featuring the darkest of crimes. Perhaps the mere fact that she is the queen of tartan noir, one of the UK’s most successful crime authors, could be enough to send most trolls running to the hills.

“I don’t know why I don’t get trolled,” she says. “That’s not an invitation to people to come and abuse me. I’m quite happy to not be trolled. But if this book does bring on any abuse, I’ll just block it. I don’t have to engage with them. That’s what I do. If I get an obnoxious tweet, I just block it.”

Her new book, Splinter The Silence, the latest in the Tony Hill and Carol Jordan series (on which the television series Wire In The Blood was based), therefore, is inspired not by her own experience, but that of friends and acquaintances. Among them, she notes, was JK Rowling, who, after she came out in support of the No campaign last year, was assailed with vitriol.

“The abuse she got when she actually expressed a political opinion was just disgraceful,” says McDermid. That the two authors were on opposite sides of the independence debate, with McDermid a vocal Yes supporter, doesn’t make her any less sympathetic to Rowling. “We had several vigorous discussions about it – and we’re still friends,” she says. “It doesn’t actually stop us being friends. And I think that was the case in the overwhelming majority of cases, but, on both sides, there was a segment of people who were just frankly bawbags.”

But it hasn’t been only Rowling’s views on Scottish independence that have triggered social media bile. Nowadays it seems like almost anything the Harry Potter author does or says appears to be a spur for an onslaught of abuse. This McDermid puts down to “nothing more than the politics of envy”. Why, then, does she herself not, as a hugely successful author, also trigger such feeling? “I don’t know,” she replies. “Maybe it’s because I go about in shorts and T-shirts all the time.”

And it’s true, McDermid strolling around in her Hawaiian shirt and jeans looks more like a local, slightly geeky Scottish eccentric than wealth personified. She gives the impression of not having left her roots – an “ordinary working-class family" in Kirkcaldy, father a shipyard worker – too far behind as she made her journey to Oxford, where she studied English, wrote her first novel and had her sexual awakening as a lesbian. A job as a journalist for the Sunday People followed before she embarked on a snowballing career in crime fiction, to sales of 11 million books.

Oxbridge these days is almost a dirty word, synonymous with a careerist, exclusive ruling elite. Yet McDermid is one of the few the public figures who can carry off having gone to St Hilda’s, Oxford, as a triumph of social mobility. Perhaps it’s because she was the first state school pupil from Scotland to go to the college, the product of the same controversial Fife Council educational experiment that Gordon Brown experienced. Or more likely it is because she has the common touch, in person and in her writing. She appears “one of us”. Yet clearly she is not. She is a kind of prodigy, and a relentlessly driven one at that.

She was, she says, “gutted” by referendum result. “There had been a lot of hope, a lot of excitement. Then at the end I think a lot of people were bullied and frightened into voting No. It was all doom and gloom. And I think that that was very sad, the way that things went at the end.”

One of the most startling pieces of Edinburgh Book Festival programming this year has been 'Val McDermid with Nicola Sturgeon'. We are chatting prior to the event and McDermid speculates, “I think Nicola is going to do a proper interview. She’s going to talk about the books. She might touch on politics, I suppose, but she is a reader.” Even before Sturgeon became First Minister, the two would tweet and direct-message about books. “I think it’s really heartening to have a First Minister who when given an opportunity to talk to a writer doesn’t immediately go for a political theorist or historian, but somebody who is read by a lot of the population of this country. She’s reading popular culture. She’s reading the same kind of thing as the voters are reading. So she’s plugged into things, not in some rarefied bubble – the Westminster bubble.”

McDermid's return to Edinburgh at the beginning of last year marked a new phase in her life. Previously, she was sharing a home with civil partner, Kelly Smith, in Northumberland, walking her dog along vast empty stretches of beaches near Dunstanburgh Castle between bouts of writing. But the two broke up. “I lost the dog in the divorce,” she says. She now has a new partner: Jo Sharp, a professor in geography at Glasgow University. “I moved back to Edinburgh because it was time, and for personal reasons. But I’m loving being back in Scotland. I’m loving being in Edinburgh.”

Entertainingly, the flat she and Sharp share, on Queen’s Street, turns out to be one which McDermid found, then "ridiculously overpriced", when she was searching through estate agents particulars for a flat to inspire her as a setting for her updated version of Jane Austen’s Northanger Abbey – and which she used in the book. Later, when she was looking for a flat to live in, she came across it again, now "only slightly overpriced". “And, reader," she says, "I bought the flat. That’s where I live.”

She also has a home in Manchester, where she stays from Monday to Wednesday every week in order to be with her son, who goes to school in the city. She shares custody with a previous partner.

Back in 2013 there had been a few articles suggesting that she had vowed to marry her former civil partner Kelly Smith when gay marriage laws were passed. “No, no, no,” she says when I ask what she now feels about marriage and that article. “I think what I said is, 'Any excuse for a party is a good one.' It’s one of the usual things, it got slightly misquoted.”

She has, she insists, always felt ambivalent about marriage as an institution. “As a feminist I find it comes with so much baggage. The history of marriage is a history of ownership, of women’s subjugation. So I like the idea of a civil partnership. I still prefer that route. But I can entirely understand why people value the possibility of marriage. And I have been to a lot of good parties this year.”

Among those parties was, several weeks ago, the wedding of Jeanette Winterson and Susie Orbach. “It was just so joyous,” McDermid recalls. The same year, however, has also brought the funerals, in quick succession, of two crime-writing friends, PD James and Ruth Rendell. “It’s been a sad year this year. Both Phyllis and Ruth, so close together.”

Meanwhile, arguably, the last few years have been among the most productive in her career. They were, she says, a “mad moment”. In 18 months she produced four books – Northanger Abbey, Splinter The Silence, The Skeleton Road and the non-fiction book Forensics. “It was,” she says, “just insane. That period of my life was a blur. Every day was get up, sit down, write. Get up, sit down, write.”

But the ideas keep coming. There seems to be no end to them. “I think in a funny way, the early death of Iain Banks made me feel even more conscious that if there are projects I really want to do, I should engage with them. Because you don’t know how long you’ve got.” Among those projects, she says, is an adaptation of John Wyndham’s The Kraken Wakes for BBC Radio 4.

Threaded through the plot of Splinter The Silence is also, quite subtly, a little bit of feminist history. Pages from books by Sylvia Plath, Virginia Woolf and Anne Sexton, all of whom took their own lives, are found next to the bodies of the women who have seemingly been driven to suicide by trolls. McDermid wanted, she says, to show that there is a “long tale of misogyny, or women feeling that their lives are impossible and quite intolerable”.

Of course, she adds, there has been progress for women, but nevertheless the very existence of trolls is something she sees as “dispiriting”. "I genuinely feel that feminism has caused women’s lives to be improved in the West. But then the availability of anonymous online trolling happens and you suddenly realise how much of it is still there underground. That old misogyny. That old unpleasantness.”

What’s striking about the book is how adept she is at dealing with the digital material, and how deftly she manages to make the hunting down of a person online into a nail-gripper of a chapter. Evidence, perhaps, of her own slightly nerdy technophilia?

“I’ve always been a wee bit geeky,” she admits. “Always an early adopter. And my partner is even more geeky than me.” Like her clinical psychologist character Tony Hill, she is a gamer. "I'm one," she says, “of that legion of middle-aged women sitting in their pants on the sofa with the game controller.” The very first PC game she ever got was Railroad Tycoon, back in 1990. “I remember getting it and I took it home that night, and I said, 'Oh, we’ll just see what it’s like.' We were still playing at 4am.”

Her latest fad, introduced to her by her son, is an online app racing game. “It is ridiculous,” she laughs. “I sit there in my office and I just write for a bit then I think I’ll just race this bizarre Maserati around Monaco for ten minutes.” The experience, she says, is “very immersive”. “It’s that sense of shifting out of where you’re head is, to somewhere else, for long enough to let your head do a little bit of revolving on its own.”

Earlier this year it was announced that the new mortuary to be built at Dundee University will be named after her, after she was chosen by a public vote. It’s not the first building with her name attached to it. There is the football stand, of course, at the Raith Rovers’ ground Stark’s Park, named not after her so much as her father, who was a scout for the team. “It’s a great collection,” she says. “A football stadium, a mortuary and a bar in Oxford. Where do I go next?”

The morgue has a very personal connection too. Professor Sue Black, who launched the campaign and is director of Dundee University's Centre for Anatomy & Human Identification, is an old friend of McDermid's – more recently they've worked on creating an online forensics course, involving identification of human remains and a short story by McDermid. Will she be donating her own body, on her death, to Black’s morgue and medical science?

“Sue is welcome to my body. We laugh about this. But the only caveat is that she’s got to give the titanium knees back to my son so he can have them made into jewellery.” There has, she notes, been a family discussion over this. “We’re all in favour of wearable mementoes in our family. When my mum died there’s a company that do high-intensity heat treatment of the ashes and make them into jewellery. So I’ve got a paperweight on my desk that’s got a swirl of my mum’s ashes in it. My son and my godson have got cufflinks of their Nana. They’ve all got a very tangible reminder. I like that.”

When she’s writing from time to time, she puts her hand on the paperweight. “It sits on my desk and I do put my hand on it a lot when I’m sitting thinking. It’s good to have these things, to be connected into your life.”

Does she, since she is writing so much about death, think a little about her own? “Not much. I try not to think about it, to be honest. Inevitably, as you get older, you become more aware of your own mortality. People that you’ve known for years, and that you love, die and that’s the nature of the cycle of life."

In the meantime there are books to write. "I’m only just 60 years old. I’m planning on being like PD James and going on writing into my nineties.” She makes a quick calculation. “So at the rate of one book a year that’s about 30 books to go."

Splinter The Silence by Val McDermid is published by Little, Brown. Val McDermid will be at the Albert Halls in Stirling on September 11 (with Peter May) and September 12 (with Lin Anderson) as part of Bloody Scotland, the country's international crime-writing festival; tickets and information at and 01786 274000