There's a running gag about old doughnuts in The Five-Year Engagement - something to do with people's impulses to grab what's in front of them, rather than wait for the fresh doughnuts promised in just a few minutes.

It's a half-baked (excuse the pun) psychology experiment, but it's also a kind of metaphor for the relationship that Violet Barnes (Emily Blunt) and Tom Solomon (Jason Segel) find themselves in. The couple at the heart of this amiable, shambling romantic comedy - a comedy laced with darker undertones, and sex and potty shtick - start to feel like old doughnuts themselves: familiar but still desirable, a little stale, yet still really sweet. But somewhere lurking in the recesses of their temporal lobes, there's the notion that perhaps there's a fresher doughnut - a better match - waiting out there.

OK, I might be stretching the meaning here - and there are these wonderfully goofy clinical group-thinks in which Blunt's character and her social-psych department confreres, led by a coolly professorial Rhys Ifans, are stretching the meaning, too. But that's one of the good things about the film - between the jokes about drinking mead out of deer hoofs, about tiny tykes armed with crossbows, about meeting cute in a bunny suit and a Princess Di getup, there's serious stuff to consider.

The Five-Year Engagement comes by way of Nicholas Stoller (who directed and cowrote), Segel (who stars and cowrote), and Judd Apatow (who produced). That's the same lineup responsible for Forgetting Sarah Marshall, and the same sensibility: It's not impossible to address grown-up issues of commitment, of responsibility, of love, and have some fun, and some profanity, while you're at it.

Segel is a sous chef at a hot San Francisco restaurant, Blunt is bound for a career in academe (or so she hopes), and the pair are perfectly happy together. So much so that Tom decides to drop to his knees and drop the big question. His elaborate proposal plan gets botched, he loses his cool, but it's corny and charming nonetheless. And, of course, Violet says yes, beaming those blue eyes back at her big lug of a boyfriend.

And then come the obstacles: Violet gets rejected by UC Berkeley, but lands a job at the University of Michigan. It's a two-year stint, and Tom says what's two years in the grand scheme of things? Well, it snows in Ann Arbor, and he can't find work commensurate with his culinary talents (or his previous salary). He ends up working the sandwich line at a deli. He's put his own career on hold for the sake of hers.

And they decide to postpone the wedding until the two years are up. Meanwhile, their respective families grow impatient, and their friends - including Violet's crazy sister (Alison Brie) and Tom's idiot savant best bud (Chris Pratt) - are getting married, and then having kids. Tom and Violet seem stuck in relationship limbo. He's losing his sense of self-worth, and she's losing sight of the man she loves. As another cold, dark winter settles over Ann Arbor, coldness and darkness settle over their relationship as well.

Segel and Blunt work well together, whether they're cooing, or crying, or dissing each other with playful affection. The supporting cast is full of surprise: Pratt's doofus-y man-boy, Brie's impulsive, Brit-speaking sibling (she and Blunt do a whole child-rearing dialogue in the voices of Elmo and Cookie Monster - very funny), Ifans' descent from enlightened academic to lowly lech, Brian Posehn as the wild, woolly deli owner, Lauren Weedman as Tom's aggressively unromantic boss, a chef back in the Bay Area.

The Five-Year Engagement gets draggy here and there, and there's a tendency to veer into the land of cute (the flashbacks to Violet and Tom's costume-party first encounter are replayed, and replayed again). But the level of emotional honesty is refreshingly high, and the level of writing refreshingly sophisticated. Old doughnuts, new doughnuts, it's a good mix.